- Home /
How to create a 3D slider
Hello. I have been searching for a solution to this for numerous days, but could not find one. How would I be able to create a 3D slider which I can drag one way or another to affect a volume multiplier between a certain range along an axis? I will have two sliders in the same place, so this might also be necessary to take into account.
Thanks :)
I am using JavaScript, by the way.
I'm in the same place, have some code you perhaps cold have some interest in - although I haven't gotten it to work fully yet: http://answers.unity3d.com/questions/287703/horizontal-slider-slides-to-limits-then-gets-stuck.html
Answer by Berenger · Jun 03, 2012 at 03:47 PM
You need an object with a collider and a script to tell you when it is clicked.
You need a slider bar along which the thumb can travel according a float between 0 (far left) and 1 (far right).
When the thumb is clicked and the mouse held down, a movement with an x positif will increase that float, an x negatif will decrease it. This can be improved by calculating the vector from the thumbs position to the mouse 3D position on the horizontal plane, then the dot product with the vector made by the bar start -> end points.
Hi Berenger, just stumbled to this post as I have been also finding the same thing. But have you tried to make a 3D UI? Or.. probably making the UI into World Space on Render $$anonymous$$ode is better? What can you share?
Your answer
Follow this Question
Related Questions
Setting Scroll View Width GUILayout 1 Answer
help unity3d javascript 1 Answer
How to shift GUI.Buttons while clicking on a slider 1 Answer
Control animation speed with slider 4 Answers
Changing 3d text through script 1 Answer