
easy rotations when affected by physics such as collisions. It means I can add simple forces such as gravity to it and not have to worry about it going through the floor. The only reason why I'm even using a rigidbody in the first place is so I can do two things: 1. I've looked in to using rigidbody.AddForce() instead but that just doesn't seem to do anything at all and on top of that the whole reason why I am writing my car script is to determine the velocity the object should be moving at thus making something like rigidbody.AddForce() which adds it to the velocity of the car more or less redundant and shouldn't be necesarry. The car becomes all floaty and nudges forward (stands on its nose) when I hit the wall, I have no clue what could be causing this seeing as I am using my own gravity (the gravity from the original Rigidbody is turned off in favor of my own custom gravity, which does result in a downward rigidbody force) and the drag, and angular drag of the rigidbody have been turned down to 0.īasically my question is do any of you guys have an idea of what could be causing my rigidbody to be reacting in such a manner, literally the only difference between my normal code and the code that is acting up is that single line change.Įdit: It's been another few hours.

To continue my story, for some reason when I set the velocity of the rigidbody instead of using transform.Translate my collision acts really strangely. Due to it being in the fixed update I should be able to at least test it to a certain extend without Time.Deltatime usage, which is why you aren't seeing that in the second example right now.

To quickly note, I am doing both of these in my FixedUpdate and I am currently only using the second example (or at least trying to use it and am miserably failing at it). Now instead I decided to do this rb.velocity = transform.forward * speed However because I want to use the Unity build in physics for collision detection I realised this wouldn't work because transform.Translate (as far as I know) literally places the object at that position, thus the object could (if going fast enough) suddenly be halfway stuck through a wall or just completely ignore the collision and appear on the other side of the wall. Now what I got so far is a quite intricate process which eventually gives me a float which is the exact speed I want the car to go until the next frame, so far I have used the following code to do that (0, 0, speed * ltaTime)

What my ultimate goal is to have some semi-realistic car physics something in between the quality of the older GTA games and the recent GTA 5. For the past few days I have been working on some custom car physics as a coding exercise.
