- Home /
Make Enemy movement "superior" to player movement.
Hello
I am making a game where there are enemies following the player. What would i do if i wanted to make the player more "ragdoll" like. What i mean is that when the enemies walks in to the player they still try to walk into him and he is not moving an inch from the collision. What i want to to is make the enemies movement "superior" to the player movement, so that when the enemies walk into the player, they push him. And if the player walks in to the enemies, he cant push them. I achieved this in the beggining but then i fiddled with the rigidbodies so it has something to do with that, but i cant figure it out.
Thank you
//Taegos
Answer by felix11 · Aug 01, 2015 at 08:38 PM
I have a few Solutions to that problem: 1. Set the Player to Layer "Player" and all Enemies to Layer "Enemy" In Edit-ProjectSettings-Physics (or Physics2D) just make it so the Player cannot collide with enemies. (Uncheck the Checkbox between Player and Enemy Layer) Then you can just use a Raycast. 2. As soon as you collide with an Enemy, set the collider to Trigger. you might have to make another Collider at the very bottom of your Character, thats flat, so the Enemy can walk over it, but you don't fall through the floor. If you have any Questions just comment
Your answer
![](https://koobas.hobune.stream/wayback/20220611233809im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Making a bubble level (not a game but work tool) 1 Answer
How to go about having two seperate Game Objects follow eachother? 1 Answer
Multiple Cars not working 1 Answer
How can I create a smooth rigidbody2d movement? 1 Answer
Is it ok to use Linear Drag and/or Mass to make an object immovable? 2 Answers