Quantcast
Channel: Questions in topic: "addforce"
Viewing all articles
Browse latest Browse all 1264

Conflict between Rigidbody Addforce and Velocity ?

$
0
0
I am using a modified version of RigidbodyFPSPlayer [LINK][1] [1]: http://wiki.unity3d.com/index.php/RigidbodyFPSWalker Here are two statements I am having a lot of conflict in: In this one when player collides with a platform and a variable turns to 1 and the following condition which is defined in FixedUpdate is called (JUMP CONDITION) if (jumpForm == 1) { Debug.Log ("Jump form 1"); rigidbody.velocity = new Vector3 (velocity.x, jumpVar, velocity.z); } Following after that is a statement which provides gravity to my rigidbody since in the beginning the usegravity is turned to false rigidbody.AddForce (new Vector3 (0, -gravity * rigidbody.mass, 0)); Here the gravity is set to 10.0f. Now whenever the value of jumpVar is smaller than 10 there is a jump which is pretty reasonable and goes high from 1-9 as soon as I turn it to 10 which is also the gravity the rigidbody jumps up high very high. ---- And also when I use both gravity and jump as AddForce the result is same and once before with a bit different code, when the value of jump was less than 1000 it didnt do anything and at later about 1500 it jumps to high high above.

Viewing all articles
Browse latest Browse all 1264

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>