Question by
AeeeejIkNikas · May 03, 2017 at 10:29 AM ·
troubleshooting
I want my stick to move relatively not center.
Hey guys! I've got a problem. I need my stick to move relatively not center, how can i do that? When i'm changing a pivot and rotating object in scene, its works fine, but when im trying to rotate my stick in game, its only rotating around center. 1st screen, is the point of rotating my stick now. 2nd screen, is the point of rotating i want.
Script i use down below
void Update()
{
if (Input.GetAxis("Mouse X") > 0)
{
this.transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y + 2, transform.rotation.eulerAngles.z);
}
if (Input.GetAxis("Mouse X") < 0)
{
this.transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y - 2, transform.rotation.eulerAngles.z);
}
if (Input.GetAxis("Mouse Y") > 0)
{
this.transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y , transform.rotation.eulerAngles.z + 2);
}
if (Input.GetAxis("Mouse Y") < 0)
{
this.transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y, transform.rotation.eulerAngles.z - 2);
}
}
Comment
Your answer
Follow this Question
Related Questions
Backsliding like a baws 1 Answer
Why wont Unity 2017.3.0f3 start? 1 Answer
Help: My player dies immediately upon start of game? 0 Answers
anyone know how to fix this kind of problem everytime i switch on my laptop? 0 Answers
Raycast Trouble 0 Answers