Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Is this possible in Unity? High speed collision setup...

Discussion in 'Physics' started by Kaji-Atsushi, May 1, 2015.

  1. Kaji-Atsushi


    Oct 6, 2012

    Basically the scene is composed of a sphere which is connected to a spring which is connected to a cube.

    The hierarchy of each CubeBall is this: Parent Game Object > Cube(with spring component), Ball.

    I have a simple script on each sphere to have an impulse force downwards every couple of seconds.

    Each Parent Game object has a script to tell it to move to the right.

    The Parent game object on the top is using
    Code (JavaScript):
    1. transform.Translate(Vector2.right * Time.deltaTime, Space.World);
    The parent gameobject on the bottom is using
    Code (JavaScript):
    1. <Rigidbody2D>().MovePosition(transform.position + Vector2(1*Time.fixedDeltaTime, 0));
    All objects have the Rigidbody component.

    As you can see the result of moving the Parent using rigidbody position vs transform position results is very different. The rigidbody script transfers over the parents momentum/velocity making the sphere swing left and right.

    I don't want the sphere to swing left and right. I want it to be like the one on top, but there's a problem with it, it cannot handle high-speed collisions. In order for me to have proper high-speed collisions, it appears I need to use rigidbody code and have the rigidbody components on the game object with the collision detection set to continuous.

    So how can I accomplish the movement of objects on the top of the video using rigidbody components and code in order to have proper high-speed collisions.