- Home /
Converting from moving local space to world space
hi, i have a Character Controller Script, here's a part of it :
function FixedUpdate () {
if (grounded) {
moveDirection = Vector3(inputX * inputModifyFactor, 0, inputY * inputModifyFactor);
moveDirection = myTransform.TransformDirection(moveDirection) * speed;
// Jump! But only if the jump button has been released and player has been grounded for a given number of frames
if (!jump){
jumpTimer++;
} else {
if (jumpTimer >= antiBunnyHopFactor) {
moveDirection = Vector3(inputX * inputModifyFactor, 0, inputY * inputModifyFactor);
moveDirection = myTransform.TransformDirection(moveDirection) * speed * jumpMoveSpeed;
moveDirection.y = jumpSpeed;
jumpTimer = 0;
}
}
} // Apply gravity moveDirection.y -= gravity Time.deltaTime; // Move the controller, and set grounded true or false depending on whether we're standing on something grounded = (controller.Move(moveDirection Time.deltaTime) & CollisionFlags.Below) != 0;
} How do I change the movement from local space to world space? ( when i walk up, it is always going north ) Thanks!
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Setting Scroll View Width GUILayout 1 Answer
I have a movement script, but how can i make it so i can move half the speed while in the air. 0 Answers
Bullet fired at enemy only applying damage when the enemy moves 1 Answer