There are a few platforms. After the player moves from one platform to another the first one is supposed to fall. The platform that the player is on is supposed to remain still until the player moves to another one. The idea is that the character/player can’t return to a platform he was already on. What I tried: #pragma strict
function OnCollisionEnter(Char){ GetComponent.().useGravity = true; }
I put this script on the platforms but they start to fall as soon as I step on them.
Or you can even put a timer or so if you want them to fall in a timely manner.
you can code it something this way
bool playerEntered = false;
float timeStood = 0f;
void OnCollisionEnter()
{
playerEntered = true;
}
void Update () {
if (playerEntered) {
timeStood += Time.deltaTime;
if(timeStood > 3) // Maximum a player can stand on the platform is 3 I put
GetComponent<Rigidbody> ().useGravity = true;
}
}