Setting Max Angular Force For Y For Jumping

 0 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? more ▼ asked Apr 30 '12 at 03:08 AM maroonrs2 -55 ● 8 ● 12 ● 13 I hate it when scripting pros are not on :) Apr 30 '12 at 03:14 AM maroonrs2 What about adding constant force and manipulating that when needed? Apr 30 '12 at 03:21 AM GC1983 more info please Apr 30 '12 at 03:24 AM maroonrs2 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

 0 I don't know how you're using these max values - you should have posted your script. Anyway, a good way to jump is to set the Y velocity directly - like this: ```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 } } ``` more ▼ answered Apr 30 '12 at 04:40 AM aldonaletto 41.5k ● 16 ● 42 ● 197 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users
 0 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.htmlsimilar to above, one note: uses controller.isGrounded to automatically check for being groundednot sure if your issue is one of move speed, or rotation. post the script if you could more ▼ answered Apr 30 '12 at 04:47 AM Seth Bergman 7k ● 10 ● 16 ● 28 I do not recomend using tag, but CompareTag as tag will malfunction. May 01 '12 at 04:11 PM maroonrs2 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

By Email:

Topics:

x1793
x318
x292
x15

asked: Apr 30 '12 at 03:08 AM

Seen: 500 times

Last Updated: May 01 '12 at 04:11 PM