absolute value of a vector

So, I’ve been working with Panda to make a technology demo for my senior animate arts project at Northwestern university.

My demo involves procedurally animating the walk cycle of a small, spider-like creature.

Relatively speaking, things have been going smoothly - getting a window up where you can move an object around via rotations and translations along its forward/back axes and setting up a camera to follow it happened quickly.

Now, I am working on using controlJoint to manipulate the actor mesh based on the current position and orientation of the actor. Getting access to the joints of my model wasn’t a big deal either.


the IK formula I’m using to make the tip of the feet go to the right spot over a short period of time goes like this: (x is cross product, . is dot product, * is multiply)

angle-to-add-to-knee-rotation = |force-vector-between-target-and-foot| * (knee-rotation x force-vector) * (shin-bone x force-vector) * (((knee-rotation x shin-bone) . force-vector / |((knee-rotation x shin-bone) . force-vector)|)

The problem is, I don’t know how to get the absolute value of a Vec3 in panda. Python’s math.fabs only accepts floats.

(amusingly enough, I even made my own dot and cross product procedures and then I realized there had to be methods for Vec3, duh!)

Thanks in advance!

ps -
If you want to read more about the algorithm I’m using, it’s from a paper called “Real-Time Character Animation for Computer Games” by Eike F Anderson, and it’s easily found on Google.

from http://panda3d.org/apiref.php?page=Vec3#length:

so you should be able to call myvec3.length() to get the magnitude.

hah! thanks a lot!
clearly I was not thinking straight while looking through the panda manual
for vectors: length = magnitude = absolute value