- Home /
Question by
FlayFlavio · Oct 15, 2020 at 05:21 PM ·
animationtriggerstuckmoving platform
Player gets stuck on moving platform
Hello there, I am completely new to Unity etc. Basically I wanted to make a simple moving platform which drags the player with it while moving. Now this works perfectly aslong as the character moves itself. However whenever I stop moving with my character, after about a second he doesnt move along anymore and falls off. Can anyone help me?
public class AttachToPlatform : MonoBehaviour { public GameObject Player;
private void OnTriggerEnter(Collider other)
{
if(other.gameObject == Player)
{
Player.transform.parent = transform;
}
}
private void OnTriggerExit(Collider other)
{
if (other.gameObject == Player)
{
Player.transform.parent = null;
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Mechanim trigger problem 1 Answer
Pose to pose animation blended with controller trigger input 0 Answers
Triggering a basic animation via Box Collider 4 Answers
Two Animations With One Button Press 1 Answer
call/trigger animation of other object 2 Answers