Add a check on the character that checks if the character is on that special platform or not. If the player is on the platform, then set the direction of the gravity to be towards the platform.
You can do this by getting the down vector from the platform (negative up vector), and setting the transformation equation for gravity to be a scalar multiple of that vector.
Something like this:
var gravity : float;
var gravDirection = Vector3.down;
function Update (){
if (onPlatform){
gravDirection = -Platform.gameObject.GetComponent(Transform).up;
}
transform.position = gravDirection * gravity * Time.deltaTime;
}
↧