I usually don’t ask for help but I’m trying something new and trying to “launch” a player into the air using a pad that sits on the ground similar to halo and for some reason I’m having trouble with such a simple task. I started out trying an OnCollision RayShoot and figured it would be easier to send a constant ray so the player wouldn’t need to make contact with the pad but instead it just launches my player into the abyss instead of just 20 feet. Here’s my script and any help would be appreciated.
var Range : float = 5;
var Force : float = 5;
function Update()
{
RayShoot();
}
function RayShoot(){
var Hit : RaycastHit;
var DirectionRay = transform.TransformDirection(Vector3.up);
Debug.DrawRay(transform.position, DirectionRay * Range, Color.blue);
if(Physics.Raycast(transform.position, DirectionRay, Hit, Range));
}
Why use raycast? I see no reason why you shouldn't put a box collider around the launch pad as a trigger and use OnTriggerEnter() to give it a force up (and slightly forward probably). Assuming you use a rigidbody, of course
– asafsitner