|
As in my code I set my max force for left and right as 40, but when i set it to 600 for my jump, i can move unrelistically fast. Any way i can just set the max y instead of x an z?
(comments are locked)
|
|
I don't know how you're using these max values - you should have posted your script.
var jumpSpeed: float = 8.0;
function Update(){
...
if (Input.GetButtonDown("Jump")){
rigidbody.velocity.y = jumpSpeed;
}
}
This code has a problem: you can jump even while in the middle of another jump. To avoid this, you can set a flag when starting a jump, and reset it when landing on the ground - but the ground or other objects where the rigidbody can land must have the same tag - Ground, for instance:
var jumpSpeed: float = 8.0;
private var jumping = false; // flag jumping
function Update(){
...
if (!jumping && Input.GetButtonDown("Jump")){
rigidbody.velocity.y = jumpSpeed;
jumping = true;
}
}
function OnCollisionEnter(col: Collision){
if (col.gameObject.tag == "Ground"){
jumping = false; // reset the flag when landing on some Ground object
}
}
(comments are locked)
|
|
need the script, not quite sure what you mean.. If you're using a character controller, you can use something like this: http://unity3d.com/support/documentation/ScriptReference/CharacterController.Move.html similar to above, one note: uses controller.isGrounded to automatically check for being grounded not sure if your issue is one of move speed, or rotation. post the script if you could I do not recomend using tag, but CompareTag as tag will malfunction.
May 01 '12 at 04:11 PM
maroonrs2
(comments are locked)
|

I hate it when scripting pros are not on :)
What about adding constant force and manipulating that when needed?
more info please