- Home /
move object with slider
I wanted to move an object through a slide. I converted the function to use the slide. Now I'm lost. How can I connect it to the object in order to move it?
Code:
var hSliderValue : float = 0.0;
var a : float;
public var max : float;
public var min : float;
public var slideX : float;
function OnGUI () {
GUI.HorizontalSlider (Rect (25, 25, 100, 30), 0.0, 10.0);
}
function calculate(){
return ((max-min)*(slideX-0)/(1-0))+min;
}
Comment
Answer by DaveA · Jul 18, 2013 at 05:02 PM
The answer to this, and most of your questions, will be found in the documentation
http://docs.unity3d.com/Documentation/ScriptReference/Transform-position.html