Vector representation VS Angle representation

Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Sep 24, 2010 at 08:39

Im talking about skinning models. As in rigging them for animation.
(I reckon the whole industry is stupid, you should call it “rigging” not “skinning”)

When your working with vectors, you get advantages and disadvantages.
When your working with angles, you get advantages and disadvantages.

Like how do I limit the head rotation so it cant spin all the way around facing backwards.

If I do it with a vector stick man, then how am I supposed to restrict the bone.

I am indeed in knowledge that if I used a rotational angle tree I would be able to limit it between two scalars… its just I wanted to work with vectors.

Note my stickmen are just vertices and lines connecting them, then I bind the model with orientation matrices so it acts to the skeleton.
This gives me ragdoll physics, its just now im stuck in vector representation and I dont know what to do…

Id perhaps want mouselook in an first person situation, but I dont want you to be able to mouselook all the way around, and what if the body changes angles, id want to keep the head so it couldnt spin back.

I realize if I did it with an angle heirarchy this would work, but then I possibly couldnt direct the head in the look vector.
[EDIT] turned out I could [/EDIT]

So whats a solution?

8 Replies

Please log in or register to post a reply.

Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Sep 24, 2010 at 08:47

Dont tell me itll take measuring angles from vectors, holy crap.

Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Sep 24, 2010 at 08:53

Oh who cares, I know how to fix it now… I just have to measure the x of the vector and the y of the vector, and convert it to rotations.

Then I could go from there.

Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Sep 24, 2010 at 08:55

Oh hang on I figured it out.

I just link the mouse vector to the actual body direction, then I can limit it to angles yes, Then when the body moves right I just move the look left.

Then I can restrict it to the shoulders.

So I guess the moral of this story is maybe you should use a bit of both.

340bf64ac6abda6e40f7e860279823cb
0
_oisyn 101 Sep 24, 2010 at 09:25

@rouncer

Im talking about skinning models. As in rigging them for animation.
(I reckon the whole industry is stupid, you should call it “rigging” not “skinning”)

Rigging is the process of defining a skeleton and assigning vertices to them. Skinning is the process of transforming the verts using the bone matrices. I have never seen those words used differently.

Anyway, you should read up on joint constraints. Angles aren’t that useful either, as they only let you constraint the rotations on the X, Y and Z axis, and not on arbitrary axes. What you could do, is defining a constraint as an axis and a minimum and maximum value. You dotproduct the axis with the bone direction, and the result should be between min and max.

Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Sep 24, 2010 at 10:09

Whats it got to do with whats on the skin anyway? I thought “skinning” was more to do with sub surface scattering.

Guess what this does, it sets instance.si[1], which happens to be if the object spins left or right. only problem is, if you measure an angle of a vector to go left is to go to the nearest left, which could be right the complete other way on the circle… so this bit of logic picks the least difference, 2 ways to go around the circle and outputs “right” and “left.”

   float angle1,angle2;
   
   angle1=atan2(instance[j].walkvector.z,instance[j].walkvector.x);
   angle2=atan2(actualvector.z,actualvector.x);
   
   if(angle2<angle1)
   {
    if(angle2-angle1<(6.28f-angle2)+angle1) instance[j].si[1]=1; else instance[j].si[1]=2;
   }
   else
   {
    if(angle1-angle2<(6.28f-angle1)+angle2) instance[j].si[1]=2; else instance[j].si[1]=1;
   }
Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Sep 24, 2010 at 10:16

Shit, what you said made me think tho - so theres better ways than just YawPitchRoll matrices?

Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Sep 24, 2010 at 10:46

ehm excuse me

   if(angle2<angle1)
   {
    if(angle1-angle2<(6.28f-angle1)+angle2) instance[j].si[1]=1; else instance[j].si[1]=2;
   }
   else
   {
    if(angle2-angle1<(6.28f-angle2)+angle1) instance[j].si[1]=2; else instance[j].si[1]=1;
   }

modification. :)

340bf64ac6abda6e40f7e860279823cb
0
_oisyn 101 Sep 24, 2010 at 11:00

@rouncer

Whats it got to do with whats on the skin anyway?

You pull the skin (the mesh) over the bones. Much like skinning an animal, although the other way around.

I thought “skinning” was more to do with sub surface scattering.

No it has nothing to do with that. That’s just skin rendering.

@rouncer

Shit, what you said made me think tho - so theres better ways than just YawPitchRoll matrices?

Why yaw-pitch-roll matrices if you could simply use general matrices. And some use quaternions, which are faster to multiply than matrices, which is especially handy in the hierarchical nature of skeletons.