Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / Rigging / Wheel spin script
  RSS 2.0 ATOM  

Wheel spin script
Rate this thread
 
62182
 
Permlink of this thread  
avatar
  • Tim
  • Posted: 22 November 2011 05:49 AM
  • Location: Philadelphia
  • Total Posts: 178
  • Joined: 22 August 2006 02:18 PM

I have a float script controlling my wheel:

dependsOn $Body.modifiers[1].tirespin.controller
spinrate=$Body.modifiers[1].tirespin
DegToRad((CurrentTime)*31*spinrate)

where the Body is the car body
the modifiers[1] is a attribute holder with a “tirespin” attribute.

The problem is this…

it works to set up the spin, but when I animate it back to zero, the wheel cranks itself all the way back to its starting point.  I just want to have the spin stop, not rewind.

The wheel has 3 Eulers on it.  1 - Zero setting 2 - Animation 3 Manual control Manual layer is active.

thanks!



Tim

Replies: 0
avatar
  • Tim
  • Posted: 22 November 2011 01:03 PM

Maybe this needs to be moved to the Rigging Discussion??



Tim

Replies: 1
/img/forum/dark/default_avatar.png

Moved from Maxscript. Tricky with this kind of question knowing where is best.

Author: Steve_Curley

Replied: 22 November 2011 09:35 PM  
avatar
  • Tim
  • Posted: 26 November 2011 11:06 AM

no rigging gurus out there want to tackle this one?  or maybe a different solution?



Tim

Replies: 0
avatar

You can probably put a conditional statement into your script so that the wheels only rotate when the body of the car is moving forward. The fastest way might be to have 2 sets of tires, one set visible and the other set not visible. Apply the script to one of the sets and swap visibility to the other set to stop rotation.



Max 2012(64) Win 7 - 64
NVIDIA Quadro FX 5800
Dual Xeon E5520 Six-Core, 3.33GHz
16GB DDR3

Replies: 0
avatar
  • Tim
  • Posted: 26 November 2011 11:32 PM

I don’t want to just stop the rotation… I want to slow it down.

As I increase the spinner now, the wheel rotation increases in speed.  I want it to work backwards as well.



Tim

Replies: 0
avatar
  • Tim
  • Posted: 02 January 2012 03:09 AM

Is there no way to do this?

I want a spinner that as I increase it, a wheel rotates clockwise faster and faster…
then as I decrease the spinner, the wheel slows down (going the same direction) and when the spinner is zero, the wheel would be stopped.  Ideally if I went into the negative values, the wheel would work the opposite rotation as well.



Tim

Replies: 1
/userdata/avatar/17c942yhr_profile_7.jpg

It’s just a matter of logic, not maxscript itself.

You’re setting the absolute value of the controller based on the Spinrate attribute.

All you need to do is read the rotation(angle) from the previous frame and then **ADD** the amount of rotation you want to increase multiplied by Spinrate.

If Spinrate is 0, the wheel maintains its previous rotation frame after frame. Note: now it does not return to 0.

Rodrigo Biffi

Author: RodBiffi

Replied: 02 January 2012 03:25 AM  
avatar
  • Tim
  • Posted: 02 January 2012 04:57 AM

Can you expand on that a bit more?

I set the spinrate as I have above.  (this creates a constant spin)
then at every frame I read the previous frame’s spinrate / rotation (not sure how to do that)

how will adding a value to spinrate slowly decrease the rotation?

Currently the script sets a spin rate based on the value of the spinner.  The problem comes in as it decreases, the wheel rotates backwards to where the original (zero state rotation) spin rate is.

Sorry.. am a bit new at the maxscript.  I am trying to understand the logic, but don’t follow exactly.



Tim

Replies: 0