- Home /
setting a character controller orientation by script
Hi I hope I am not asking a dumb question...
I am creating an application in wich I use 3 cameras : a fly camera (the user is free to fly in the scene), and 2 character controller based cameras. I switch from the fly cam to one of the character controller camera using a trigger (collider set as trigger) At the beginning of the scene, the character controller is inactive and got an initial orientation (let's call it Orient0).
When I switch to this camera the orientation is the initial orientation. I walk around, put the character controller in a specific orientation (let's call it Orient1) and switch back to the fly cam (pressing escape key) I fly around and re enter the trigger.
The character controller is, at this time, in the Orient1 orientation. Why ?
I have tried everything (store the initial orientation, restore it the FPSWalker.js script with a frame delay, without a frame delay, restore the orientation before the camera activation, after the camera activation, with 2 frames delay, outside of the FPSWalker.js script) the character controller camera is always in the orientation (Orient1) the character was before switching back to the flycam.
Anyone got an hint ? an explanation ?
Thank you
I don't understand your question. You leave the char in Orient1, switch to the fly cam, move that cam around (and therefore NOT the char controller?), and switch back to the char cam - which obviously hasn't moved and ist still at Orient1.
when I switch back to char cam, I set the orientation (to "Orient_that_I_want") of the character controller (tried before and after activating it) but the orientation is not modified. The orientation is still Orient1. I am still puzzled.. does this make any sense to you ? Is there an orientation cache system upon activation in the "not all source code accessible" character controller ?
It is almost impossible to answer your questino without seeing some of your code; especially how you switch back to the char controller and set the orientation. Also, how exactly do you "switch" between cameras? With c.enabled? or c.depth? some other way? How exactly do you navigate your char / char controller)? If your fly cam doesn't have a char controller, how do you navigate that? Or is it fixed? Or does it follow the char?
Answer by mike f · Aug 19, 2010 at 10:56 PM
related - does anyone have a controller for flying? or moving in 3D versus on terrain?
This is not an answer; please do not ask new questions inside other questions (even when related). Just ask a new question - it is much more likelty to be noticed.
Your answer
Follow this Question
Related Questions
Singling out mutiple Character movement 3 Answers
Swapping Cameras Disables Keyboard Input 3 Answers
How can I change the character beign controled and the camera with a button? 1 Answer
Camera shake 2 Answers
character switching on collision 1 Answer