I have a moving platform that I am able to stop and restart by pressing a key. I would like to be able to collide with an object in order to stop the movement of the platform. How can I do this?
Not to sure what you want the outcome to be, but this should be helpful to understand how to stop something,
public float moveSpeed = 3.0f;
void Update()
{
transform.position += Vector3.forward * moveSpeed * Time.deltaTime;
}
void OnTriggerEnter(Collider coll)
{
moveSpeed = 0.0f;
}
I just threw the movement update in there to show you how to have a variable control part of your movement speed, then when it equals 0 from something going inside of the triggerzone it will stop the platform from moving.