troulbe moving joint with joystick input

My problem is probably fairly easy to overcome, I just don’t know the right way to get the information I need.

I have a model, and I want to translate (not rotate) the joints using analog joystick input. Joystick works fine using pygame module. The problem is that the only examples I could find on manipulating joints was to set a joint to a rotation such as Eve’s head in the Eve demo.

The problem I have is that Panda wants to take the joystick input and insert that as the position instead of adding or subtracting from the original joint position, so it sticks everything to 0,0,0. I have a root joint at 0,0,0, but than let’s call one of its childern jointA at 10,10,10. I want to manipulate jointA, so I’d like the joystick to add to 10,10,10 and not over write the joint information that’s there.

I basically need to pull the original position information out of joints and store that info, but I don’t know how to do this. Any thoughts? Also any thoughts on a way that I can search through the documentation and answer these types of questions on my own? After 2 hours of searching I finally gave up, but this seems like such an easy thing to do.

Thanks,

Brian

if you wanted to add a vector of (10, 20, 30) to the exposed joint’s starting position it would go something like this:

newX = exposedJoint.getX() + 10
newY = exposedJoint.getY() + 20
newZ = exposedJoint.getZ() + 30
exposedJoint.setPos(newX, newY, newZ)

You could use the above to call something like setX(newX) instead of setPos on the exposed joint if you didn’t want to use all 3 dimensions. If you know you will using all 3 dimensions, you could also use this:

translation = Vec3(10, 20, 30)
newPos = exposedJoint.getPos() + translation
exposedJoint.setPos(newPos)

Vec3 is imported from pandac.Vec3