Invert rotation when moving backwards
I'm trying to get an object to act somewhat like a car/tank when it comes to turning. For instance, if the wheel in a car is turned right and forward motion is applied the car should go in a circle. With the wheel still turned to the right but backward motion is applied the car should complete that circle but in reverse.
My current script does the opposite. To use the same example, when backward motion is applied it's like the wheel is now turned left. With physics like these, you could make a three-point turn without ever changing the direction the wheel is turned.
I've Googled plenty of car and tank scripts but everyone seems to shy away from this specific mechanic. Many of the YT videos only drive forward using a basic script which is fine just not accurate.
I thought this would be simple but I'm new to programming in general. This is what I have so far:
The idea was if S (reverse) is pressed, invert the rotation of the horizontal inputs(a and d). The invert was supposed to occur by changing "Vector3.up" to "Vector3.down" when S was pushed down. This changed nothing. I'll continue googling, etc.
Any help would be appreciated. Even explaining why this code doesn't revert the rotation would help me learn.
Edit: There are downloadable car controllers but the ones I've seen use tire physics. I'm trying to get this to work on a simple cube.
Your answer
Follow this Question
Related Questions
WheelCollider RPM values all over the place, how can I get more even values? 0 Answers
wheel collider / script offsets the meshes 0 Answers
Whats wrong with my car auto park AI scripts?,What am I missing from my car auto park code? 0 Answers
How do I calculate grip of a tyre and make it grip and slide realistically? 0 Answers
automatic levelling out airplane when near the ground? 0 Answers