D
D
Deman12020-02-28 00:42:55
C++ / C#
Deman1, 2020-02-28 00:42:55

How to make the character not pass through the object?

There is a character and tilemap on the wallpaper there are colliders, also rigidbody2d on the character Body Type Kenematic, on tilemap static
The code that I move the character

rb.MovePosition(rb.position + moveVelocity * Time.deltaTime);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DanielMcRon, 2020-02-28
@DanielMcRon

Move Position is not for you, most likely. For 3d games, I recommend you the Character Controller and its Move method.
For 2D games, movement in RigidBody using velocity.
Move Position is a method that is not for character control and interaction with walls

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question