Normalising joysticks - Xform?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  02 February 2009
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.
  02 February 2009
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.
Paul Neale
  02 February 2009
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
Disclaimer: My opinions are not those of my employer.

  02 February 2009
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!
  02 February 2009
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 10:38 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.