In my game, the player can jump through hoops which adds to the player’s current velocity. On contact, each hoop passes a Vector3 to the player script, however, if I tilt the hoop to create angled jumps, the Vector3 passed does not change, so the player is thrown in world space. Is there any way to change the Vector3 passed from the hoop depending on its angle so that the angle affects the direction of the jump?
Thanks!
Here’s the hoop script.
var gameScript : GameController;
var velocityToAdd = Vector3(0,10,0);
var localRotation : Vector3;
function Start (){
gameScript = GameObject.Find("Player").GetComponent(GameController);
}
function OnTriggerEnter (myTrigger : Collider) {
if(myTrigger.gameObject.name == "Player"){
gameScript.addVelocity(velocityToAdd);
Destroy(gameObject);
}
}
Thats perfect, much simpler, thanks!
– ataxk