Baddie Character Falling Over?

Baddie Falling Over?

Hello all,

I am having a couple of small problems that I am hoping a couple of you might br able to help. I have only just starting adding other non-playable characters to the project and the problem stems from that.

The first problem is that my “baddie” character keeps falling over at the start of the game. I am using the rigidbody component as the ground in the cave is really uneven and when I finally get the baddie moving I want them to stick to the ground. The second component is the capsule collider as I do not want the hero to move thru the baddie.

Now is the only way to stop my character falling over on start, to use constraints of the X-Z axis or should I be using something else? I am imaging having the constraints locked would cause a problem down the track with movement, or is this assumption wrong?

The second problem is when the player rotates to face the hero, after walking in the cave, with the constraints on and gets hit falls over again? So is there some method of stopping this as well.

And just in case my code for rotating the character is causing any problems, this is what I have been using:

 Quaternion rotation = Quaternion.LookRotation(player.position - transform.position );
transform.rotation = Quaternion.Slerp(transform.rotation,rotation, Time.deltaTime  * 1);

(it’s from an older project that I did 2 years ago)

To anyone who can help here is a big thankyou in advance.

Regards.

Another couple I’ve things I’ve noticed since last post are: if the hero jumps near the baddie - that is without hitting the baddie - the baddie character also has a tendency to fall over. And for a laugh, if I run into the baddie enough, the baddies position ie, the x,y,z transforms, will change, so … so much for the constraints working - it’s like the baddie is rolling blading (slowly) across the floor :hushed:.

I did try putting a box collider around the character to stop the colliding - but, I put it at the transforms position, so, of course that didn’t work - though never seen a box collider moving around the floor before :).

So, any suggestions would be greatly appreciated.

Warmest Regards.

Managed to solve the issue after 2 days of playing around - anyway just had a flash of inspiration amongst all the perspiration and tried turning of the colliders on import - seemed to to the trick. Hopefully the capsule collider will keep everything in check.

I don’t know why having the colliders off makes it work!?! But that shows how much I know about Unity.