Notifications
Clear all

[Closed] Normalising joysticks – Xform?

For a while now I’ve had a joystick creation system that lets me link joystick sliders to bones (or anything else really) to control their rotation and translation.

This issue that I’ve always had is that the scale I have to work at is quite small so building a joystick that goes from -1 to +1 is massive on the screen – therefore I build all my joysticks so that they go from -0.05 to +0.05 and then normalise in my expressions or wiring.

I’m now thinking that this is a hack, and that I must be able to build them at that small scale, yet have them work as if they run from -1 to 1.

I’m at home rather than at work so I can’t experiment, but I’m thinking that I might be able to construct the joystick (bounding box with circle and text) and then scale it with an Xform modifier. I’m sure someone will have ran into this issue before and can advise me if I’m heading in the right direction.

3 Replies
 PEN

Well it is possible to just scale them, the xform will not produce the result you are looking for as the control object will still travel a distance from -1 to 1. Scaling isn’t optimal either as you just shouldn’t do it. I would do what you have been doing and set up he math based on the size of the control. What you could do is have the auto creation setup a custom attribute that is driven by a script controller and does the normalization and then wire you bones to the custom attribute.

 eek

To put an interpolation into a value between 0 -1/-1 all you do is change you reference space. E.g If i want to get a value of 0-1 in a space of 10 – 20, you essentially make a ratio:

(t – 10) / ( 20-10) e.g (15- 10) = 5.0 and (20 – 10) = 10.0, 5.0/10.0 = 0.5 this will work back wards too:

(5-10) = -5 , (20 – 10) = 10, -5.0/ 10.0 = -0.5

Eek, the normalisation ratio is what I currently do – I calculate the size of the joystick and multiply that up for all the equations (truthfully I’m lazy and use 20 as the factor since I know it’s always the same).

Paul, that’s a really nice idea. I could build the joysticks as normal then script an intermediate normalisation layer. Hmm, I think I’ll give that a try.

Thanks folks!