-
3rd January 2013, 11:19 AM
#1
Slipstream vehicle physics?
Just wondering how you guys set up the vehicle physics in Unity, did you use raycasting and spring joints?
-
3rd January 2013, 12:55 PM
#2
Simpler than springs. Just basically apply Newton's laws of motion.
You know that for an object to stay in rest no forces can be applied on it: Fr=0 (being Fr the sum of all forces applied on the object).
So here you have the gravity pulling down on the ship so you create a force that counters that gravitic pull, making your ship still in mid-air. Then you make that levitating force vary with the inverse of the ship's height above the ground (F=k/h in which F is the force that counters the gravity pull, k is a constant that works like a "bounce" factor and h is the raycast distance between the ship's geometric center and the track, measured perpendicular to the track's polygons) so that the ship maintains it's height after jumps and bumps.
Last edited by Xpand; 3rd January 2013 at 01:07 PM.
-
3rd January 2013, 02:32 PM
#3
Thanks for the reply.
Just trying to understand it.
I've set the Rigidbody of the ship to 1000 and added a raycast downwards that stores the distance between the center of the ship & the track. I then have a bounce rate float of 600000 that is divided between the raycast distance, the results are then added as downward force from the ship.
This gives a hover effect but doesn't seem to spring to a height above the track. I'm doing something wrong I imagine, but I don't know what.
-
3rd January 2013, 02:52 PM
#4
I guess you need some adjustments on having the floating force variate with the height. Does your ship drop below/ fly away from the normal floating height after jumps or bumps?
-
3rd January 2013, 03:00 PM
#5
It doesn't follow the slope of the track (just a plane with rotation on it for now) it just goes forwards and crashes in to the track.
-
3rd January 2013, 03:21 PM
#6
Are you sure you're measuring the raycast between the ship and the track? Because the force alone would be enough to keep your ship at the same height in every point of the track.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules