Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question 2.5D Shmup Fishtank Physics not working. Just Jittery. Need help

Discussion in 'Physics' started by Fressno, Sep 2, 2021.

  1. Fressno

    Fressno

    Joined:
    Mar 31, 2015
    Posts:
    185
    Hey.
    So im making a 2.5D Shmup close to Sine Mora Ex style.
    The problem i have is that i need the player ship to be inside a "Fishtank", and move "freely" inside it, while the fishtank moves towards its goal.
    The fishtank is moving with a waypoint script
    Code (CSharp):
    1.     transform.position += transform.forward * speed * Time.deltaTime;
    in FixedUpdate. without a rigidbody.
    The player is a child to that Fishtank, and has a rigidbody setup, with Interpolate on.
    Its moving with :
    Code (CSharp):
    1.     private void FixedUpdate()
    2.     {      
    3.         movement.y = upDownInput * movementSpeed * Time.deltaTime;
    4.         movement.z = leftRightInput * movementSpeed * Time.deltaTime;
    5.         rb.velocity = new Vector3(0, movement.y, movement.z);
    6.     }
    The camera is fixed to the Fishtank at the moment.

    The problem is that the Player Object and Objects coming into the game view jitters.
    Its like a force is pushing them and gets tired and the object stops, and then starts pushing again, and stops.
    This happends about 2- 4 times every second.
    All i want is a smooth movement of the objects inside the camera view.

    How would i achieve that?

    Ill gladly answer any questions.