zazz Posted August 15, 2010 Share Posted August 15, 2010 Hey guys, wonderin if u could help me with... I wanna wire a custom attribute that would control the rotational velocity of an object (wheels on a car) Should be simple, but i don't know the syntax, basically add the variable to the last frame's rotation Link to comment Share on other sites More sharing options...
stormchaser Posted August 15, 2010 Share Posted August 15, 2010 if you could tell us what exactly you want to achieve we can offer better help. Link to comment Share on other sites More sharing options...
zazz Posted August 15, 2010 Author Share Posted August 15, 2010 Sure thing I have a vehicle with 6 wheels to be animated. I expect it to change speed a lot throughout animation, so, i assign a custom attribute "velocity" to the parent object and wire it up to the wheels. So, with every successive frame i want to add my variable "velocity" to the current ZRotation of the wheels, so that i can key the "velocity" attribute instead of each individual wheel. Hope that makes sense... Link to comment Share on other sites More sharing options...
Gus_Rayvus Posted August 15, 2010 Share Posted August 15, 2010 You need to "wire it" based on position rather than velocity. Since, in max's "brain" there is no speed just position. You could use a "scripted controller" and work out your circumference of your wheel to distance traveled from 0,0,0to rotation. if your vehical is turning it becomes more complicated. Link to comment Share on other sites More sharing options...
zazz Posted August 15, 2010 Author Share Posted August 15, 2010 While MAX certainly has no understanding of velocity, it does understand time. So is there a way to fetch an object's ZRotation value from the previous frame, and add a variable to it's rotation in the current frame? So, basically, i want to add a variable (which i called "velocity") to ZRotation every frame... Link to comment Share on other sites More sharing options...
Gus_Rayvus Posted August 15, 2010 Share Posted August 15, 2010 Well it does and doesn't. it understands frames and position. You can run a script after you have animated the vehicle, that would look back a frame or frames and see the position of the vehicle and calculated the distance and then update your rotation key frame, but any changes you make in the animation you would have to clear the keys and run the script again. Or you could use a scripted controller that would rotate the wheel the correct amount when ever you moved the car. In real time, animated or not. Velocity and speed are not important in what you described earlier. I think all you need is rotation based on distance so the tire surface moves accordingly to the road surface and rotates the correct amount per movement. Link to comment Share on other sites More sharing options...
zazz Posted August 15, 2010 Author Share Posted August 15, 2010 Ok, how do u go about looking back a frame? Link to comment Share on other sites More sharing options...
Gus_Rayvus Posted August 15, 2010 Share Posted August 15, 2010 b = $ thelastframe = sliderTime thelastframe = lastframe - 1f at time thelastframe print b.pos Above is how you look one frame back on the position of an object, but seriously though Sergey, I just told you why one way is so much better than the other and you still want to go that route? Anyways, good luck. Link to comment Share on other sites More sharing options...
zazz Posted August 15, 2010 Author Share Posted August 15, 2010 Thanks, appreciate it The reason i prefer this solution to the one you've mentioned is that the car is going to be on a hilly, sandy surface - meaning that it will drift, jump, and skid while braking, so the rotational velocity isn't necessarily proportional to motion... Link to comment Share on other sites More sharing options...
Gus_Rayvus Posted August 15, 2010 Share Posted August 15, 2010 Someone has made a nice dynamic rig for free with spring weight, etc. I cant remember who it is, but it was on cgtalk, do a search on cgtalk. To script what you described would be a nightmare. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now