- Home /
Rigidbody collision movement similar to a wall
Hi all,
This is my first attempt at a unity project and I'm doing something that I thought would be rather simple. I'm creating a 2D sprite-based system with a simple 'follow the mouse' movement system. There are currently two types of entities: "player" and "enemy", and currently when they run into each other, they attempt to push each other out of the way. Right now I'm moving through RigidBody2d.MovePosition
on Update
(not FixedUpdate
), but there's no particular reason for that.
I will say that I want to skip movement through adding forces if I can help it, simply because I want to avoid the 'on ice' effect I get when I change direction.
What I'm after is the movement that I get when I put a stationary (non rigidbody) collider in the scene, and then my non-kinematic non-trigger player walks into it. Their movement is not allowed to continue into the collider, but some portion of the movement is allowed to go 'around' the wall. That's exactly the motion I want, but for the two rigidbody based entities - I want them to have to move around each other.
I've been playing with this for 3 days now, and haven't found a good solution yet. Any help or direction would be appreciated. Thanks in advance.