sliders for changing properties in realtime. but how?

im certain that this is possible, so i was wondering how could i make a slider in the game engine that changes a certain property? for example ive made a mouselook script, and it uses a sensitivity property, so i wanted to change this property based on where the slider is. thanks for any help.


The movement of the slider would be controlled by an animation (IPO in 2.49, F-Curve in 2.5x). Make the number of frames in the slider animation correspond with the mouse sensitivity factor. For example, if you want the sensitivity factor to vary between 0.5 and 1.0, make the animation 50 frames long (start: 1, end: 51). Use the FramProp field on the IPO or F-Curve actuator to send the frame to a value. Use a Property sensor that fires when the FrameProp changes, and set the sensitivity factor to based off of the frame of the animation (in this example, you would set the sensitivity to (FrameProp - 1)/10 + .5)

I hope that makes sense.

i guess i should clear up what i wanted, i would like to have it react to the mouse, like a click and drag slider. thanks anyway

You can make it a click and drag slider. You just have to drive the animation with mouse movement. That would require a Python script, and it would take a bit of figuring to get the slider to properly follow the mouse.

I am actually working on a reusable slider component at the moment, cleaning things up and making it as easy to add to new projects as possible. I will be sure to post a link once it’s done.

OK, So heres a quick video of what I have so far. I’m still thinking of ways to clean things up even more/make it really easy to just plugin to other projects.

Check out Sunjay03’s color slider or his GUI elementsthread.