I tried whit LookAt, but that only made it look like strange to the right side of the car.
So i though it might have been the local position problem so i added the TransformPoint.
But that made the wheel spin like cracy… any thought on have to fix this?
Also looking into the Car tutorial demo but dont seem to get any hit here.
The Drawray, point it the direction i want to. That what it so anoying
Well i am using the Jcar tutorial. I mention that in my first post. Just not by the Jcar name.
But i havent really understood it and is heavy on coding.
That where i got the for loop.
But as i see it. It add itself into a wheel class whit all kind of stuff.
Being it hard to read on in it.
So i though i make it easy and do just rotate the wheel.
My best success is having made a empty gameobject inside of the car and the moving that object and having the wheel look at that object.
But i have the wheel in a like array and i loop tru them so the all look at the same point. Which is not good.
That where i came up whit having to look at the transform forward look at that could be a fix point.
But that didnt add up either.
But your code make me come back at my first problem.
That the Wheel keep looking to the side.
So maybe it the car model that screwed up still.
So have to figur a way to export the model so that transform.forward is the forward motion.
But i had no luck in that area.
Exporting from blender to fbx model.
I rotated it and i picked diffent angel of forward and up direction in the export.
The front of the car has to be facing forward. you can “fix” this by putting this script on an empty game object and attaching everything else to that. This way your orientations will be correct. At worst, you will have to also attach your wheel graphics to empty game objects which are orientated right.
got it working now, when i added that empty gameobject and turn the car correctly.
And your code fix the wheel turning also.
But i cant tell if it does when it moves around.
But having it stand still and only turn make the wheel turn.