read bone rotation

Posted By: Puppeteer

read bone rotation - 09/26/12 23:24

Hi!

I am currently going for procedural animation and ik stuff and i miss a way of reading the current bone rotation (euler angles/quaternions (?)) of a specific bone.

Because at the moment I have to store the rotation of the bone separately which is kinda messy.

Is there a way to directly read the bonerotation?

(For the future something like ent_getbonerotation & ent_getbonerotationworld might be usefull)

Thanks in advance
Jannes / Puppeteer
Posted By: Ch40zzC0d3r

Re: read bone rotation - 09/27/12 04:44

ang_for_bone or vec_to_angle with bone position
Posted By: Puppeteer

Re: read bone rotation - 09/28/12 13:16

Nop.
You can not get the relative bone orientation with that.
It seems to me that the only way to get the relative bone orientation atm is to set the entities pan/tilt/roll to 0 and than use ang_for_bone and then set the entities orientation back.

But this causes somehow the entity to be rendered with an orientation of 0,0,0 instead of its true orientation, which seems to be bug.

And since there does not seem to be an accurate way to calculate the relative bone orientation from ang_for_bone and the entities orientation
[ the result from ang_for_bone is ang_add(relative_bone_orient,ent.pan) ]
--> the problem still exists.

Sample project
Posted By: 3dgs_snake

Re: read bone rotation - 09/28/12 13:40

Hi,

Perhaps I don't understand what you want to do, but perhaps you could:

  • Get the global bone orientation using ang_for_bone
  • Transform that to a matrix with ang_to_matrix
  • Get the entity's orientation
  • Transform the orientation to a matrix
  • Compute the relative orientation using this
  • Transform back the result into an angle


Hope that helps.
Posted By: Puppeteer

Re: read bone rotation - 09/28/12 15:05

Damn, you are right! Thanks!
I thought that wouldn't work because of the ambiguity of the euler-angles...
Posted By: FBL

Re: read bone rotation - 09/30/12 13:36

/think "...we should not need to do this manually...we should not need to do this manually...we should not need to do this manually..."
Posted By: jcl

Re: read bone rotation - 10/01/12 15:00

I take this as a suggestion to implement a function for reading the relative instead of the absolute bone rotation.
© 2024 lite-C Forums