x


Smooth gravity collision

So I've been trying to get a smooth gravity collision between 2 objects with C# without using the Gravity from the rigidbody.

But right now the 2 objects slightly clip through each other causing it to look like the object is bouncing.

The code I'm using is

    void Update () {        
        velocity += gravity * Time.deltaTime;
        transform.position += velocity * Time.smoothDeltaTime;
    }

Does anyone have any tips on how to create a smooth collision between the two?

more ▼

asked Feb 03, 2013 at 03:22 PM

Skami gravatar image

Skami
1 1 2 2

(comments are locked)
10|3000 characters needed characters left

1 answer: sort oldest

Fixed it by using

Vector3 gravity = new Vector3(0,9.8f,0f);
    void Update () {        
        rigidbody.AddForce(gravity, ForceMode.Acceleration);
        rigidbody.useGravity = false;
    }

instead.

more ▼

answered Feb 03, 2013 at 06:23 PM

Skami gravatar image

Skami
1 1 2 2

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x9793
x4167
x787
x359

asked: Feb 03, 2013 at 03:22 PM

Seen: 614 times

Last Updated: Feb 03, 2013 at 06:23 PM