Question by
unity_F4roCKCKLxjryw · Feb 11 at 10:57 PM ·
c#rotationscripting problem
Rotating object over time
So I have a small scripting issue I know what I want and it's partially working but not the way I want it to. So basically I want the code pins to add a rotation and well it's working but not over an amount of time like with an (s)lerp. but that doesn't work because I want to add a rotation not move a rotation to another.
Here is my code (and an image if it helps to explain my idea)
void Update()
{
bool TheBool = Player.GetComponent<LockInspector>().OninspectLock;
RaycastHit hit;
Ray ray = camera.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit) && TheBool == true && (Input.GetKeyDown(KeyCode.Mouse0)))
{
if(hit.transform.tag == "RightPin")
{
hit.transform.Rotate(0, -36, 0);
}
else if(hit.transform.tag == "MiddelPin")
{
hit.transform.Rotate(0, -36, 0);
}
else if (hit.transform.tag == "LeftPin")
{
hit.transform.Rotate(0, -36, 0);
}
}
}
a235db16acb4456d2d61304d82d6d7ee.png
(519.1 kB)
Comment