hi guys i have a jumping script that i found it here but i need to add delay before start jumping and unfortunately idk scripting ![]()
here’s the code:
var speed : float = 6.0;
var jumpSpeed : float = 8.0;
var gravity : float = 20.0;
private var moveDirection : Vector3 = Vector3.zero;
function Update() {
var controller : CharacterController = GetComponent.<CharacterController>();
if (controller.isGrounded) {
// We are grounded, so recalculate
// move direction directly from axes
moveDirection = Vector3(Input.GetAxis("Horizontal"), 0,
Input.GetAxis("Vertical"));
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
if (Input.GetButton ("Jump")) {
moveDirection.y = jumpSpeed;
}
}
// Apply gravity
moveDirection.y -= gravity * Time.deltaTime;
// Move the controller
controller.Move(moveDirection * Time.deltaTime);
}
idk how to use yield waitforseconds
Thank you for all supports!
Just because you don't know doesn't mean you shouldn't check it out. [Coroutine][1] [1]: http://unity3d.com/learn/tutorials/modules/intermediate/scripting/coroutines
– cdrandini don't have any experience in scripting Sorry..but i'll check it cuz i wanna learn it
– MohammadAlizadeh