- Home /
Absolute character movement and collision
Hey guys,
I'm making a really simple Bomberman clone, just for practicing purposes. In it's most basic form it exists of a top-down 2D view of a character walking around in a grid. My problem however is that I want to move characters around and have collisions, but I don't want to use physics. After searching around I heard a lot of solutions but none work for me.
My player movement script just uses transform.translate with a Vector2 for its movement and these are the problems I run into:
Whenever the character walks into a wall, the character overlaps with the wall and keeps bouncing back a little.
The movement with the arrow keys feels slow, as if you are dragging around the character. Only on very high speed settings this does not occur.
Whenever I release the movement key, the character still moves forward for about 0.05 seconds. This might seem marginal but it is not ideal to have characters sliding forward a bit.
Currently, for my player I am using this setup of components:
A RigidBody 2D with continious collision detection and a mass of 1. The rest of the options are 0 or false.
A circle collider2D.
For the walls and the objects the player shouldn't walk into I use the same set of components I described above.
My ideal situation would look like this:
The character will only move when a key is pressed, and immediately stops moving when the key is released.
The character does not bounce back and forth when walking into a collision.
My question therefore is: What approach, or combination of approaches, should I use to achieve the aforementioned goals? Any advice would be great and I will supply more information if that is needed!
Thanks!
You're using physics in character movement, which is causing physics simulation where none is needed. Use kinematic rigidbodies ins$$anonymous$$d.
Your answer
Follow this Question
Related Questions
Player glitching through wall when sprinting 1 Answer
2d Platformer Jumping Not Working 1 Answer
Making a collision between 2d objects 1 Answer
Simple movement problem. Need units to stop dead on collision. 3 Answers
How can I make a non-player character (rigidbody) move when they touch the ground? 1 Answer