void FixedUpdate() { //var fromCameraToPlayer = mainCameraTransform.transform.position - playerTransform.position; // this drew a line from the camera to the player var fromCameraToPlayerOpposite = playerTransform.position - mainCameraTransform.transform.position; // this drew a line from the player in the opposite direction of the camera :D which is what I want! Debug.DrawRay(playerTransform.position, fromCameraToPlayerOpposite, Color.blue); var playerDesiredRotation = Vector3.ProjectOnPlane(fromCameraToPlayerOpposite, Vector3.up); // line parallel to ground instead of at an angle var angleOfDesiredRotation = Vector3.SignedAngle(playerDesiredRotation, playerTransform.forward, Vector3.up) * -1; var debugPlayerAimRay = new Vector3(playerTransform.forward.x, playerTransform.forward.y, playerTransform.forward.z) * DebugPlayerAimRayLength; debugPlayerAimRay = Quaternion.AngleAxis(angleOfDesiredRotation, Vector3.up) * debugPlayerAimRay; Debug.DrawRay(playerTransform.position, debugPlayerAimRay, Color.green); rikishiController.SetDesiredAimTarget(debugPlayerAimRay + playerTransform.position); float h = CrossPlatformInputManager.GetAxis("Horizontal"); float v = CrossPlatformInputManager.GetAxis("Vertical"); var movementVector = v * playerTransform.forward + h * playerTransform.right; rikishiController.Move(movementVector.normalized); }
void SitStill() { rikishiController.Move(Vector3.zero); }