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

AddForce Relative to Rotation

$
0
0
While I know this question has been asked a lot, mine is different than most of the others. :( -------- Well I'm attempting to figure out AddForce, and I'm having the common "addforce relative to direction" problem. Since I have four different directions (WASD), I can't exactly just say, "transform.forward * speed" Here's my current AddForce: move is a Vector3 that has the values according to the speed I want to go, AKA: `move = new Vector3(speed, 0, -speed);` The `move` values are generated based on userinput; If the user press "W", move.z changes. ;) Here's my code ATM: `rigidbody.AddForce(new Vector3((move.x - rigidbody.velocity.x) * 0.5f, move.y, (move.z - rigidbody.velocity.z) * 0.5f), ForceMode.VelocityChange);` Any ideas?

Viewing all articles
Browse latest Browse all 1264

Trending Articles



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