- Home /
Question by
rubixcube55c · May 05, 2021 at 05:48 PM ·
c#rotate3d modelmultiple objects
How to rotate multiple objects in a certain position instead of the middle?
I am trying to make an unofficial Portal game in Unity and found good codes to rotate the player, but the issue is that they rotate around the middle of the model instead of a certain position. How do I set the rotation position? Here's the rotation code I use:
using UnityEngine;
public class MouseLook : MonoBehaviour
{
public float RotationSpeed = 15F;
// Update is called once per frame
void Update ()
{
transform.Rotate(Input.GetAxis(("Mouse X") * RotationSpeed * Time.deltaTime), 0, Space.World);
transform.Rotate(Input.GetAxis(("Mouse Y") * RotationSpeed * Time.deltaTime), 0, Space.World);
}
public float minimumX = -360F;
public float maximumX = 360F;
public float minimumY = -60;
public float maximumY = 55;
}
There's also an issue with the code, it's rotation is inverted but not in the way you think.
Moving the cursor up turns the player right. Down turns the player left. Right turns the player down. Left turns the player up.
Comment
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
Rotate my Object with Mouse and Touch 0 Answers
Rotating a model with increments 1 Answer
How do I rotate a Gameobject to a given direction smoothly? 1 Answer