- Home /
(2d) Enemy not killing player if player stand still?
Just learning and I have followed some tutorials and am just tyring to get basic mechanics of a 2D game going.
I use Uscript ( Visual Scripting Tool ) so I will just have to explain what my code is.
My controller is an edited first person controller to 2D
My enemy is a prefab sprite with a box collider that moves via moving the game object under global update.
I then have a script that basically just says
OnTriggerEnter of the Enemy and Trigger is instigated by Player, then do blahblah
This seemed to work every time when you run into the enemy or jump into it. But I noticed that if I just stand still with the character, the enemy walks past the character and nothing happens. For some reason, it is only working when the player is moving.
Any tips advice? Or am I going about this in a poor way?
and please remember I use a visual scripting tool so explaining in logic instead of code would really help!
thank you!
Answer by Vire · Jan 29, 2014 at 06:27 AM
Make sure there is a Rigidbody on your object that contains the trigger collider. I had the same issue when making AI with a collider, where if the player stood perfectly still the AI would ignore him - unless the AI had a rigidbody.
Your answer
Follow this Question
Related Questions
my enemy is broken 1 Answer
Object: collider to floor, trigger to player 1 Answer
Damaging Enemies 1 Answer
Cannot get position of other objects 2 Answers