Quantcast
Channel: Answers by "2d4Games"
Viewing all articles
Browse latest Browse all 24

Answer by 2d4Games

$
0
0
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; }

Viewing all articles
Browse latest Browse all 24

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>