FPSController won't move with platform
I have a super simple scene with a flat terrain and Unity's standard FPSController plus a moving platform (controlled by animation). On top of the platform I have a Box Collider marked "IsTrigger" and a simple C# script attached:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Moving : MonoBehaviour {
public GameObject thePlatform;
void OnTriggerEnter(Collider other) {
other.transform.parent = thePlatform.transform;
}
}
When the player steps on the platform (and enters the trigger), he is supposed to follow along. But it doesn't work! The player just slides off the platform.
During gameplay, when checking the hierarchy panel, the FPSController becomes a child of the platsform as expected, and the X-position in the inspector panel is increasing (as if he was moving) but he is standing still. The camera is kind of "shaking" back and forth.
Any suggestions?
I'm using Unity version 2019.1.1
Your answer
Follow this Question
Related Questions
Making a hit meter 1 Answer
How do i extend a animation ? 1 Answer
How do I not trigger animation during play state of the triggered animation. 1 Answer
ANIMATION TRIGGER DOESN'T PLAY 1 Answer