- Home /
Question by
sizofrengaming · Jan 09, 2019 at 07:03 PM ·
cameratransformdirection
Object hold and mouse roll
when i hold object and roll mouse button it's rolls on self (x,y,z), I want rolls on camera lookway direction
if (Input.GetAxis("Mouse ScrollWheel") > 0f)
{
transform.Rotate(Vector3.up, smooth * Time.deltaTime);
}
if (Input.GetAxis("Mouse ScrollWheel") < 0f) // geri
{
transform.Rotate(-Vector3.up, smooth * Time.deltaTime);
}
my problem video: https://youtu.be/O5pq-Az5bLU
Comment
Best Answer
Answer by Ady_M · Jan 10, 2019 at 08:30 PM
Instead of Vector3.up use the camera's y-axis and also set the 3rd parameter to Space.World
transform.Rotate (Camera.main.transform.up, smooth * Time.deltaTime, Space.World);
Your answer
Follow this Question
Related Questions
Setting a cube to be exactly size of intersecting camera view plane 1 Answer
How can I change the "forward" direction of my model? 5 Answers
Mathf.Abs and How to play animation only if x,z transform has changed by 0.2 units ? 2 Answers
GUI.Button child of the camera . 0 Answers
How do I set a child object to not rotate if the parent WILL be rotating? 1 Answer