Return to site

Gta 5 semi realistic physics

broken image

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.

broken image

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

broken image

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.

broken image
broken image

For the past few days I have been working on some custom car physics as a coding exercise.