Question by
tiendang212 · Oct 06, 2020 at 05:04 AM ·
enemy ai
Enemies fly through fast to players (through wall) and fly again
Hi! I'm newbie in unity and i want to make an enemy like ghost can wall through wall and when the enemy see play they will fly fast and through player and again. Here is my code:
//fairy rotate to player
var rotation = Quaternion.LookRotation(target.position - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * damping);
//fairy move to player
moveDirection = (target.position - transform.position).normalized * speed * Time.deltaTime;
fairyBody.AddForce(moveDirection * 50f);
But I don't what to do next. Please help me. Thank so much.
Comment
Your answer
Follow this Question
Related Questions
Enemy AI does not trigger event... 0 Answers
Ragdoll Spawn Problem 1 Answer
2D game how to make my enemy can evade the laser of my player 0 Answers