Ok i know this might be a stupid question but ive been trying to get this to work, for example
The player would Jump just like normal with spacebar, but if you walk forward (Hold UP) then press the spacebar to jump you would jump but you can constantly keep doing it till your position is out of the planet..
heres my attempt:
` if (Input.GetButton ("Jump") && rigidbody.velocity.y == 0)
{
rigidbody.velocity = Vector3(0,5,0);
}
if (Input.GetAxis ("Up") && Input.GetButtonDown ("Jump") && rigidbody.velocity.y > 3)
{
rigidbody.velocity = Vector3(0,0,0);
}
else
if (Input.GetAxis ("Up") && Input.GetButtonDown ("Jump") && rigidbody.velocity.y < 0)
function Update () {
var controller : CharacterController = GetComponent(CharacterController);
if (controller.isGrounded)
print("We are grounded");
}
else you can use a raycast, cast it downwards and see when it intersects with the plane. If the distance is less then x you can jump.
Trust me, very little is impossible in Unity. :)
... But it doesn't take much to run into impossibilities either. :) For example I haven't been able for the love of my life to add extra vertex data to meshes besides the normal, uvs, color and the usual suspects.
Are you using a rigidbody or characterController.
– FLASHDENMARK