x


Enemy following Player on uneven surface

Hi all!

I managed to make an enemy(character controller attached) follow the player on an even surface. Basically, I animate based on the difference of positions between them:

Player.transform.position - enemy.transform.position

But, on uneven terrains or levels it moves toward the player THRU or flying over them instead of moving on it. does anyone know how to get over this problem?

Thanks in advance.

more ▼

asked Nov 21 '10 at 03:09 AM

uhahaha gravatar image

uhahaha
397 2 3 14

(comments are locked)
10|3000 characters needed characters left

1 answer: sort newest

Are you using controller.Move()? If you simply move the transform of your enemy, it will ignore any collisions. But if you use controller.Move(), the collisions are handled by the character controller. I made this mistake myself, not too long ago...

more ▼

answered Nov 21 '10 at 02:19 PM

The_r0nin gravatar image

The_r0nin
1.4k 9 14 30

Thanks a lot. This solves the problem.

Nov 26 '10 at 02:41 AM uhahaha

Please click the check mark next to the answer, so it is logged as answered (so other people who are searching similar problems will know this post is helpful).

Nov 26 '10 at 02:58 AM The_r0nin

loginuhahaha would you mind sharing the code? Thanks :).

Feb 17 '11 at 10:12 PM joeyrubio
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3324
x1366
x1041
x957
x652

asked: Nov 21 '10 at 03:09 AM

Seen: 1608 times

Last Updated: Nov 21 '10 at 03:09 AM