//Bullet Physic's version of FixedUpdate. public void UpdateAction(CollisionWorld collisionWorld, float deltaTimeStep) { //Jank Super Jump jumpSpeed = Input.GetKey(KeyCode.LeftShift) ? 18 : 8; //Movement Logic Vector3 localWishDir = inputHandler.GetWishDir(); Vector3 worldWishDir = transform.TransformDirection(inputHandler.GetWishDir()).normalized; Debug.DrawRay(transform.position, playerVelocity, Color.red); Debug.DrawRay(transform.position, worldWishDir * moveSpeed / 2f, Color.blue); QueueJump(); if (GroundCheck()) { GroundMove(worldWishDir, deltaTimeStep); GroundJump(); } else { AirMove(worldWishDir, localWishDir, deltaTimeStep); } UserInputVelocityClamp(); Vector3 currentPos = transform.position; Vector3 targetPos = currentPos + (playerVelocity * deltaTimeStep); //Should I be multiplying by deltatime here? characterMover.MoveCharacter(collisionWorld, currentPos.ToBullet(), targetPos.ToBullet()); }
// FixedUpdate is for passing inputs along to the controller script. private void FixedUpdate() { player.MoveCharacter(xMovementf, zMovementf); }