- Home /
Problems with character controller
I'm developing a game that consists of two balls. One of the balls is the main player which is controlled by you and the other is the enemy that has an AI script and it follows the main ball. The problem is that when the enemy ball collides to the main one, it doesn't move, that's because of the character controller. But, on the other hand, if I deactivate it, the controls don't work. My question is: What am I supposed to do in order to be moved by collision without deactivating the character controller?
Here is the webplayer in order to see the bug: http://dl.dropbox.com/u/19201848/webplayer%20ballsgame/webplayer%20ballsgame.html
Thanks for your time and interest!
Your question is pretty vague and doesnt really make any sense.
"What am I supposed to do in order to be moved by collision without deactivating the character controller?" - to be moved? Do you mean that if the NPC runs into the PC, it should push it around?
From what I see, the AI object circles around the player object and occassionally moves close to collide with the player object, and then start circling it again. You dont have to have a CC on the AI object for it to work. That all comes down to the code you make for it.
When I was first starting off with scripting I found that this helped me "http://unity3d.com/support/documentation/ScriptReference/Transform.Translate".
With these commands and things I basically put the get$$anonymous$$eyDown function on each direction with the W,A,S,D controlls. This also allowed me to put a rigidbody on it and it still worked fine.
Just make sure you create an empty game object and put the sphere inside it, then apply the movement script to the game object and the ridged body to the sphere.
Hope this all makes sence and hope it all works :)
Answer by tekiro_devil · May 04, 2012 at 08:15 AM
I think I understand what your saying but unfortunately I don't know how to fix it, maybe I can clarify for others though.
pretty sure he means when the enemy contacts the player it doesn't push it because it's only told to move if the player controller moves it. So it stays rooted to the spot unless the player moves it. aka there's no "bounce" on the player only on the computer object
This is not an answer. If this is what they are saying, it doesnt move because its a CC. If it had a rigidbody, it could create something of a "bounce" because it was given physics properties. If you have two Character Controllers running into one another, they will not move each other. They will only stop due to collision detection through the CC.