Calculating angles and rotations!

This is related to my other question but I thought the kinect aspect might put some people off looking at it so here is a non kinect version!

I’ve attached a very simple patch (different to the last patch :) explaining the issue.

It’s to do with calculating angles between positions. I’m using the technique of subtracting two vectors and then using a polar node to work out the angle between the two positions.

This works great apart from at certain points the angle will unexpectedly flip 180 degrees in one axis!

The patch shows this happening and what it is I’m trying to achieve with it.

Any suggestions much appreciated!

Rotation Test.v4p (39.2 kB)

one solution, switch subtraction depending on positive or negative values

Rotation Test2.v4p (40.3 kB)

That breaks as soon as I make it rotate around more than one axis again

angles in 2d

I understand that but don’t get how it helps.

sorry!

Just to note the solution you gave worked in 2d but I need this to work in 3d.

Hope I’m not misunderstanding you.

maybe i have time tommorow to look into it again…but i guess its something similar to my first approach. switching values according to the output…if positive or negative.

Thanks U7

I’ll have a play with that technique too.

Feels that there must be a more ‘correct’ way to approach this too though

well it’s clear why yaw flips 180 degrees… your “trajectory” is crossing through the pole of the spherical coordinate system. Imagine if you stand around, pointing your arm at an airplane. If it passes directly overhead, at one point you have to quickly spin around to be able to follow it.

If you can, rotate the coordinate system in such a way that you never pass through the pole. If that’s impossible, welcome to the madness of quaternions!
edit: or, you could connect the subtracted yaw values to the Rotate’s X, not Y pin! this looks correct, no?



Rotation Test-maybesolution.v4p (39.2 kB)

Right yes got ya. Thought this was the case.

Had a little play with the quaternion nodes but then got bored and did something else… :)

Will have a look at your maybesolution. Thanks!

Hmmmm, when I multiplied the Yaw rotation by -1 your fix seemed to work (the bone was rotating the wrong way once I moved it in the other axis)

but it seems to break when I move the parent joint also (the red box. try gently changing the value from zero in the 3rd index of the IObox in the top left corner of the window) You can see the same thing happening where it’s crossing through the pole.

Grrrr. Is this a job for quaternions then? or do I need to just position the pole in the place least likely to cause trouble?..

yeah or just fall over backwards

just founded frac actually did the job in our case

Hi antokhio

Did you get the kinect skeleton data working with Matthias’ skeleton nodes?

If so could you let me know a little about how, including how you got round the problem I’ve been having?

Thanks

And how might I change where the pole is in a polar rotation?

hi mrboni, xd
about skeleton nodes, first thing they seems pretty fine.
had 2-3 test character rigs with 3dsmax and appeared that opencollada max plugin have a bug, with exporting character rigs, to test try to import astroboy_walk.dae back to 3dsmax so it’s better if someone with blender knowledge can post some character with rig to test.
I’m using now model from character animation workshop called guy.x with humanoid skeleton.
my current rig for you guys to check how we going to survive with that ;]

sure most welcome for ideas ;]

CharAnim.rar (247.3 kB)

ah hah.

thanks antokhio

I’ll check this out and get back to you…