|
What is the best way to rotate an object (on the z axis) with a GUI component? I am making a kind of sandbox/create style game, and for scaling, I used a horizontalslider by setting the objects localscale.
(comments are locked)
|
|
It's really up to you, or you could google studies on user interaction and usability. You could use a slider for that, or a couple of buttons (rotate counterclockwise, rotate anti-counterclockwise), or detect a drag on the object itself. Thanks for the quick response! I think that I will use another horizontal slider, just to go with the flow of things. But when I tried to do this before, it was very buggy, and only worked if I called the objects transform.rotation. What should I do?
Mar 19 '11 at 10:32 PM
Xedfire 1
Yeah you'd map the slider's value to (I'm guessing) 0 to 360 and set that to object's transform.rotation.z
Mar 20 '11 at 01:30 AM
DaveA
Or use transform.Rotate() and feed it a degree, which would be applied per-frame. So send small values of essentially delta-z-rotation, then your slider would be like a 'rotate velocity'
Mar 20 '11 at 01:31 AM
DaveA
yeah, I did try using 0 to 360, but it seemed that it only worked with 0 to 1. But even then it didn't rotate the object properly, and glitched when going backwards. I've just tried doing transform.Rotate(), but it doesn't work the way I'd want it to. As you said, it would be like a "rotate velocity". There is also quite a lot of lag applied because it is rotating it every frame.
Mar 20 '11 at 09:34 AM
Xedfire 1
Can you edit your question to include your code?
Mar 20 '11 at 09:58 PM
DaveA
(comments are locked)
|
|
can you post your code here, because i have the same problem and don't know what to write.
(comments are locked)
|
