- Home /
Can I do a "rotatory" UI like this?
Hi, I'm making the UI for my game and I want to add this effect to it: http://youtu.be/iRhV04HmfjQ?t=1m37s (There is a video of my property, just what I searched it to explain better)
If you look, the interface moves with the mouse movement, I want to do something like this, but I have tried so many different ways that I could think without great results.
I will appreciate all the help that you can offer to me. Thanks.
Works perfectly, thank you very much, now I just have to modify it to work within my ideal parameters. Thanks again :)
Answer by AlwaysSunny · Feb 28, 2015 at 05:24 AM
I assume you're using Unity 4.6+ UI? If so, just set your canvas to exist in world space and rotate either it, or your camera, based on the mouse's distance from the canvas's center.
I have a subtle touch of this in my game - less obvious than this video. I did it by rotating the camera to LookAt() a fraction of the mouse position. LookAt(Input.mousePosition * 0.02f). Since my canvas's center is the world origin, this creates the intended effect quite easily.
How you approach this will vary somewhat depending on your project, but the principle is the same.
If not using 4.6+ UI, the principle is the same, but this effect cannot be [easily] achieved with the legacy GUI system.
Your answer
Follow this Question
Related Questions
Converting OnGUI function to UI 1 Answer
Health Bar Percentages Problem 2 Answers
Interface relative scaling 0 Answers
Problem with GUI element following enemy 0 Answers
Bad result of changing RectTransform values (Anchor Preset) programmatically 0 Answers