Controlling a motion within a range using joystick (beginner question)

Hi all,

I am fairly new to blender and still trying to learn as I go along. I have read a lot of tutorials on motion control using actions in BGE but I still can’t figure out how to control my motion within a range. What I mean is that, in this case for example, I have hand whose index finger is rigged to bend. I have two motions defined bend and unbend each consisting of 30 frames. Moving the stick to the right bends the finger and moving it to the left unbends it, however I can’t bend finger halfway (for example to frame 20) by moving the stick half way to right, and then unbend it from that point by moving the stick to the left (from frame 10 to 30 in terms of unbend motion). When I move the stick to the right halfway and stop moving the finger continues bending all the way to frame 30. I have attached my bend file to this post. Could someone please give me some guidance or point me to the right direction here?.

Attachments

hand2.blend (290 KB)

if I tell you can I use your beautiful hand ? ^^

just kidding :
http://jerome.le.chat.free.fr/download/draft/hand2.blend

you can use a property (int or float) to specify the frame of an action to be displayed.
here I created a ‘bend’ property which is updated by the joystick, then used by the action actuator
there’s also some stuff to control min and max values.
(you give me a hand ?)

littleneo,

Thanks for your help. The method you are using makes much more sense for what I am doing, however the finger still keeps on bending even when the joystick’s stick is halfway in the middle. Basically what I want is for the finger to stop moving when the stick is not moving, e.g. when the stick is in the middle the finger should stop at frame 15.

Joystick is basically feeding a number btw 0 and 1 to the blender, depending on its position. What I want to do is basically correlate the number between 0 to 1, to a number btw 1 and 30 and assign that as the frame number, is that possible?

By the way, you are welcomed to use the hand model however you want.

Thanks

however the finger still keeps on bending even when the joystick’s stick is halfway in the middle. Basically what I want is for the finger to stop moving when the stick is not moving

you can play with the threshold value of each joystick sensors : threshold tells from which axis value the sensor will send a + value to the controller. maybe your joystick is not well calibrated, and when it’s idle, it continues to send a +1 or a -1 (as it did for me at a first test).

… or test with 2 keyboard inputs

Never used a joystick with Blender myself but I’m quite sure that you can’t do this with only Logic Bricks because the sensors can only either send a positive signal or a negiative one. If you know Python you can take a look at the “axisValues” variable. Here’s a link to the API:

http://www.tutorialsforblender3d.com/GameModule/ClassSCA_JoystickSensor.html

you are right I think you can’t know the axisValues with bricks, it’s only False or True.

BUT you can say to the joystick brick that the axisValues interval [-5,+5] is False with this threshold parameter.

littleneo & umfk. Thank you very much guys, I got it working thanks to you guys. Basically, I converted the joystick axisValue to a number between 1 to 30, and assigned that number to the bend property using a python code. The working hand is attached to this post.

Thanks,
:slight_smile:

Attachments

hand3.blend (298 KB)