- Home /
Question by
JustACode · Jun 08, 2021 at 11:57 PM ·
2d game2d-platformer
How do I make it so that a gameobject can not be moved by the player?
Right now I am making an enemy and I realize that it can be easy be pushed around by the player. So I wonder how do I make it so the enemy (gameobject) can not be pushed around by the player and be able to move around freely using rb.velocity.
Comment
Best Answer
Answer by JustACode · Jun 09, 2021 at 01:43 PM
I made some improvements to my current system and I fixed a bug that made my enemy freeze up time to time, I used transform.translate which help out with the stuck part.
Answer by Cornelis-de-Jager · Jun 09, 2021 at 01:12 AM
Lock the x, y and z directions on the RigidBody.
@Cornelis-de-Jager Yes, I have already done that but it still locks the enemy in place and rb.velocity will not be able to move it. Do you have another suggestion?