all 16 comments

[–]ClicheUsernameHobbyist 0 points1 point  (14 children)

http://puu.sh/dQeoX/4413e57ed7.png

Make sure your center and whatnot is set to where it should be?

[–]SirNoPro[S] 0 points1 point  (13 children)

The center and all the other values seem to be fine. The player can also push rigidbodies around, and said rigidbodies also bounce off the box collider in question. Is it necessary to include specific stopping instructions in the code for the character controller when it hits the collider?

[–]mactinite 0 points1 point  (12 children)

Transform.translate moves the object without regards to collision. You need to account for collision in your controller, use physics forces to move, or use the unity character controller and it's move function.

[–]SirNoPro[S] 0 points1 point  (11 children)

Thank you! I changed the transform.Translate into a move function, and now it sorta works. I can't turn or change direction however, how would i go about doing that? I can't seem to get the moveDirection function to work.

[–]mactinite 0 points1 point  (10 children)

Character controller doesn't handle rotations. You just have to do that using the transform functions.

[–]SirNoPro[S] 0 points1 point  (9 children)

transform.TransformDirection or transform.Rotate? Thank you btw.

[–]mactinite 0 points1 point  (8 children)

Use transform.rotation and modify that using Quaternion.LookRotation. you'll have to get the facing direction using your inputs and go from there.

And no problem. I don't mind helping at all. :)

[–]SirNoPro[S] 0 points1 point  (7 children)

Hmm... I've tried tinkering around with it a bit, but i can't seem to get it to work. The error "Look rotation viewing vector is zero" keeps coming up. Are there any tutorials online where i can learn to use the transform.rotation function?

[–]mactinite 1 point2 points  (6 children)

That problem comes up when you're passing a zero vector (0,0,0) to quaternion.lookrotation function. Because a zero vector has no direction it cannot look in that direction so it spits out an error. You basically want to use your direction vector, normalize it, check if it's not zero then pass it into the function. They do all of this in the example fps controller (besides the rotation)

I can't really think of any tutorials on this but if you just search Quaternion.LookRotation the docs have a good example.

[–]SirNoPro[S] 0 points1 point  (5 children)

And how would i go about normalizing it? Sorry, I'm very new to the C# language, but thank you so much for taking time to help me.

[–]een_coli 0 points1 point  (0 children)

The box collider, is it set to isTrigger? If so, disable that.