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?