#Rigidbody Movement Interpolation

1 messages · Page 1 of 1 (latest)

ancient thorn
#

Can you screenshot how the scene looks? @analog hatch

#

Alt + Print Screen only captures the active window.

analog hatch
#

do you mean this?

ancient thorn
analog hatch
#

ah

#

that one is kinda complicated currently

#

but here is it

#

worldobject are not attached any scripts

ancient thorn
#

What type of game is it?
Do you need very precise movement?

analog hatch
#

i want to make game like nimble quest

#

the head must move precisely to make the followers move correctly

ancient thorn
#

Alright. Saw the steam video just now.

#

Will you be needing real-life like physics simulations, like making objects collide with players or players with enemies?

#

That's the strength of the physics system, but not all games need it.
Movement is achieved by either adding forces or manipulating the rigidbody.velocity directly

analog hatch
ancient thorn
analog hatch
#

yes, at least currently

ancient thorn
#

How does that work when you move when being collided with?

#

or does that ever happen to the player? (ah, yes, you said so earlier)

#
private Vector2 tempPos;
private void FixedUpdate()
{
  MoveDirection(currentDirection);
  Debug.Log(Vector2.Distance(tempPos, transform.position));
  tempPos = transform.position;
}

    public void MoveDirection(string direction)
    {
        if (direction == "Left")
        {
            rb.velocity = new Vector2(-1 * speed, 0);
        }
        else if (direction == "Right")
        {
            rb.velocity = new Vector2(1 * speed, 0);
        }
        else if (direction == "Up")
        {
            rb.velocity = new Vector2(0, 1 * speed);
        }
        else
        {
            rb.velocity = new Vector2(0, -1 * speed);
        }
    }
#

in this code you set the velocity
which means you will override physics simulations

#

Does this currently behave as you want?

analog hatch
analog hatch
#

i use rb.velocity because its simple for my current brain blushie

ancient thorn
analog hatch
#

yes, they are sync alr

#

wierdly, i used same method but they are sync, player doesn't

ancient thorn
#

So there's nothing obvious going wrong, you are mostly worried about the difference in the numbers?

analog hatch
ancient thorn
#

So technically they are not completely in sync?

#

Do you have an example I can compare to Nimble Quest?

analog hatch
#

hmm, lemme record if i can

ancient thorn
analog hatch
analog hatch
#

i think i found the solution
changed interpolate -> none

#

thank you anyway

ancient thorn
#

Rigidbody Movement Interpolation