W
W
WasTabon2022-03-18 19:53:37
Unity
WasTabon, 2022-03-18 19:53:37

Does a platformer player fly instead of falling?

private void FixedUpdate() 
    {
        posPlayer = new Vector2(playerObject.transform.position.x, transform.position.y);
        Vector2 posObj = new Vector2(transform.position.x, transform.position.y);
        Vector2 newPosition = Vector2.MoveTowards(posObj, posPlayer, Time.deltaTime * speed);
        if (isPlayerEntered)
             rigidbody2D.MovePosition(newPosition);
    }

Tipo it moves normally .
If it falls, it's also normal, but if it's stupid, the object begins to soar when it falls. How can this be fixed? isPlayerEntered == false
true

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question