x


Problems with pitching and banking?

I'm struggling with my 'look at' script.

Everything works fine with my enemy AI - untill they collide with colliders other than the "player".

I think the problem is the Raycast on the floor (anchor point is at the bottom of my enemys' feet), which causes enemy banking and pitching when they hit these colliders (being rigidbodies) which confuses them.

Is there a way to prevent this from happening or resetting them the moment their p or b changes and forcing only heading rotation at all times?

What I dont want is a 2D character, which worked but then colliders, falling etc doesn work at all.

Thx S:

more ▼

asked Feb 09 '11 at 09:13 PM

Steven Brewis gravatar image

Steven Brewis
3 2 4 6

This is how it looks forward:

if (!Physics.Raycast(transform.position, fwd, 5) & !Physics.Raycast(transform.position, right1, 5,layerMask) & !Physics.Raycast(transform.position, left1, 5,layerMask) & !Physics.Raycast(transform.position, fleft,5,layerMask) & !Physics.Raycast(transform.position, fright,5,layerMask)){
    transform.LookAt(target);
    transform.Translate(Vector3.forward * zombieSpeed * Time.deltaTime);
Feb 09 '11 at 09:15 PM Steven Brewis
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
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:

x43
x7
x5

asked: Feb 09 '11 at 09:13 PM

Seen: 365 times

Last Updated: Jul 19 '11 at 01:35 AM