|
Allo there. I'm having a strange issue when attaching a First Person Controller as a child of another transform, namely an elevator. The parentTransform is rotated 180 degrees so as soon as the function fires, the First Person Controller rotates around 180 degrees to match it's new parent's localspace. Same thing happens in reverse, the FPC flips a 180 when it becomes relative to worldspace again. The code looks a lil' something like this: I know it works like a charm when the parentTransform isn't rotated, but I'll need to set up multiple elevator instances, each with their own unique position & rotation. Thanks! Edit: Added Photos as visual-aide.
(comments are locked)
|
|
That's a weird thing: I tested the First Person Controller and a moving platform rotated 180 degrees, but nothing wrong happened - the player entered and exited the trigger without changing its rotation, as expected. I tried all the modes in the Character Motor / Moving Platform fields, and nothing changed. Could you have some other script zeroing the FPC localRotation? Or are you using another control script (not CharacterMotor.js)? By the way, if you're using the standard CharacterMotor, there's no need to child the character to the platform - the script already provides control for moving platforms - just let let Character Motor / Moving Platform / Enabled checked in the Inspector, which by the way is the default. Thanks for the reply, Aldo. There's no script that I know of zeroing the localRotation, and I'm using the default CharacterMotor.js w/ default settings. However, the framerate goes jittery if I don't child the FPC to the moving platform. It's nice and smooth as a child, and works like a charm on the main elevator (no instance rotation). I'm uploading a video to YouTube to give a better idea of what's going on.
Jun 11 '12 at 02:10 AM
chuckbergeron
Video's finally ready! http://www.youtube.com/watch?v=403zIiyieS4 Also, this is in Unity 3.5.0f2 Pro with default character controller.
Jun 11 '12 at 03:27 AM
chuckbergeron
You were right. The 180 degrees thing doesn't seem to matter when I pull the elevator out into a brand new test project, and use complete default First/Third Person Controllers. Cheers!
Jun 11 '12 at 04:46 AM
chuckbergeron
Glad to know it worked!
Jun 11 '12 at 01:52 PM
aldonaletto
(comments are locked)
|

Here's a video showcasing the strange behaviour: http://youtu.be/403zIiyieS4
The first bit shows with Moving Platform enabled, no child/parenting going on, and jittery movement.
After that, with child/parenting via script and the strange rotation issue happening in the Aux elevator instance (rotated 180 degrees).
Lastly, I go over to the working elevator (rotated 0 degrees) and it's smooth as silk.
Cheers!