Collider is not triggered during object moving

when the triangle is moving, the collider is not triggered. the triangle still can cross the boundary.

private void FixedUpdate()
    {
        Vector2 position = rb.position;
        Vector2 translation = direction * speed * Time.fixedDeltaTime;

        rb.MovePosition(position + translation);
    }



Unfortunately, you don’t say or show what “the boundary” is here and it takes two colliders for something to happen. Presumably this ia a TilemapCollider2D and presumably you’ve also added a CompositeCollider2D and presumably set that to Outline meaning there’s only outlines to contact here. No idea.

MovePosition isn’t special, it just temporarily sets the velocity to move to the point you specify so in that regard, it’s no different than you setting the velocity. All the normal collision detection and response stuff isn’t changed by this and uses all the same rules as it normally does.

A 2D physics guy should understand that the gray blocks are supposed to be made from impenetrable concrete and the green boxes are deadly acid mined on planet Ishna and the triangle is a placeholder for a beautiful princess named Julia.

Why is Julia passing through the wall?

A physics guy understands physics and never implemented “grey blocks” behaviour. :wink:

1 Like