|
I'm trying to implement an object that will follow behind my player AND rise and fall as my character jumps and land, drops in descent, etc. The AI is currently using a character controller as collider and is able to follow the player's transform with an offset, but when the player is standing still or jump and matches the AI object's Y, the AI bounces up and down. I am currently using a character controller and characterController.Move(). He is not being affected by gravity. Here is my current code: Is there a more effective way to make this AI and still retain his solidity?
(comments are locked)
|
The question has been closed Jan 21 '12 at 12:43 AM by SirVictory for the following reason:
The question is answered, right answer was accepted
|
Check if your AI character has a Character Controller this kind of component reacts to gravity, so when your AI tries to "reach" the player it inmediately falls down. And it tries to reach the player agaian and falls ans goes on and on. That's the reason of the Bouncing. Try to elliminate the gravity reaction from your code. And do you really need a character controller? why no trying a regular Collider? doesn't that fit your requirements? I also think you don't need the last three if's in your Update function. Remove them. My AI component uses a character controller, and no, it's not affected by gravity. A regular controller could work as well. The last three If's are the only reason why he lifts in the first place.
Jan 18 '12 at 05:09 AM
SirVictory
(comments are locked)
|
