FPS controller don't change local rotation after parenting
Hello, I'm trying to do moving platformon on which player can stand. I used both FPS controller and Rigidbody FPS controller. I made a trigger on the platform so player is in only when he stands on platform. When player is inside trigger his parent is platform, in other case null:
using UnityEngine;
using System.Collections;
public class PlatformStick : MonoBehaviour
{
void OnTriggerStay(Collider other)
{
other.transform.SetParent(this.transform);
}
void OnTriggerExit(Collider other)
{
other.transform.SetParent(null);
}
}
If player jumps, he leaves the trigger so his parent become null. Player changes his local coordinates so global coordinates don't change. But local rotation don't change so if platform is rotated, players global direction changes sharp while local rests on, for example, (0,0,0). It's weird for me, maybe there is a way to fix it? Simple rigidbody cube don't suffer from it, he changes both local position and rotation.
Your answer
Follow this Question
Related Questions
reset a GameObject parents childs to 0 if a item has changed its parent 2 Answers
Following object (arrow) slides off of a object 1 Answer
How to move an object left and righ (looping) when it still move to left with it parent 0 Answers
Unable to get Player to stay on Moving Platform, Collision not being detected. 0 Answers