Results 1 to 20 of 25

Thread: Slipstream vehicle physics?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Slipstream vehicle physics?

    Just wondering how you guys set up the vehicle physics in Unity, did you use raycasting and spring joints?

  2. #2
    Join Date
    Apr 2010
    Posts
    1,529

    Default

    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.

  3. #3

    Default

    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.

  4. #4
    Join Date
    Apr 2010
    Posts
    1,529

    Default

    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?

  5. #5

    Default

    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.

  6. #6
    Join Date
    Apr 2010
    Posts
    1,529

    Default

    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
  •