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.
Edit: Added Photos as visual-aide.
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.
answered Jun 11 '12 at 01:18 AM