QUOTE(xenondrink @ 07/16/08, 01:57 PM) [snapback]288408[/snapback]
I am having a problem with an automatic wheel rotation script for a car. The expression works fine at first, but when the car rotates (changes direction) the expression breaks. I wrote the expression to use the TranslateX to drive the Y rotation of the wheels. It seems that when the car turns 90 degrees the Z axis is now the front axis and the wheels no longer rotate.
Well yes for your questions but that alone does not help.
A location is a vector. Rotation of a wheel is a function of the line integral against the coefficent of the direction of the wheel. Thats a nifty way of saying its the distance of the path traveled so far against how the wheel happened to be aligned at every possible moment to that path.
See the problem is that a wheel can reach any point of space with a unlimitted amount of solutions. So at any given point in space the wheel can have any rotation. Now the rpblem is that all this has NO perfect solutions, just sveral problematic ones.
So no theres no value you can ask fr free movement. You could compute it tough no problem. Easiest schenario is to just do a per frame calculation of path length. This offcourse DOES NOT work out in realtime it works out in playback when every frame is played. It still has a bit of problem, deciding wether or not the wheel rotates forward or backward is a bit tricky (ditances are allways positive), also knowing when the wheel follows a hill upwards and when its flying and does not need to rotate right si a bit of a problem, like is any slipage etc. (this is by far the most used one tough i dont really care so much for this solution anymore)
If however yu use patth anim you can just ask the value travelled, tough for a 4 wheeled wehicle its not perfectly accurate as the wheel on the inner of a curve would need t rotate less.
Get some of the premade car rigs.
So not as easy as you think Not terribly hard to guestimate but then again it depends on your level of profficency. I am a mechanical engineer by education so stuff like this was part of what i was taught out. Thing si that the full working of a car wheel is REALLY complex, took about 4 years to teach out all thats needed for that after all basic education including college. And i still cant quite figure out all the nuances.