If i jump on that platform i use this script to hold the character on that platform, so it move with it:
void OnTriggerEnter (Collider other)
{
if (other.gameObject.tag == "Player")
{
other.transform.parent = gameObject.transform;
}
}
void OnTriggerExit (Collider other)
{
if (other.gameObject.tag == "Player")
{
other.transform.parent = null;
}
}
The problem with that is... i also get the same rotation of that object(platform) and this makes the problem. If i jump on it or from it away. I get a whole different rotation on my character and it makes it unplayable.
To rotate the platform i use this script, both scripts are on the rotating platform:
float y;
public float speedY;
void FixedUpdate ()
{
y += Time.deltaTime * speedY;
transform.rotation = Quaternion.Euler(0,y,0);
}
↧