i have this moving platform… and it goes up and down… but evertime im onboard, after the platform goes completely up and start descending, the character falls trough the platform… i belive this happens because of the rude transition of up to down movment the platform is doing
so in order to stop this i would like to make the platform stand still for a couple of secounds when it reaches its peak… and only after this wait , it will start going down again… this should solve the transpassing problem…
the code for the platform is here
var targetA : GameObject;
var targetB : GameObject;
var speed : float = 0.1;
function FixedUpdate () {
var weight = Mathf.Cos(Time.time * speed * 2 * Mathf.PI) * 0.5 + 0.5;
transform.position = targetA.transform.position * weight
+ targetB.transform.position * (1-weight);
}
these targets are te point to point that the platform moves