Two ways to do this that I can see. Your mileage may vary...
Use the transform to rotate a unit vector and see how far it's rotated:
csVector3 v = mesh->GetMovable()
->GetTransform().This2OtherRelative(csVector3 (0, 1, 0));
float r = atan2(v.z, v.y);
Or, more simply, extract the value from the rotation matrix:
float r = acos(mesh->GetMovable()->GetTransform().GetT2O().m33);
And for a rotation around the y axis:
float r = acos(mesh->GetMovable()->GetTransform().GetT2O().m11);
And the z axis:
float r = acos(mesh->GetMovable()->GetTransform().GetT2O().m22);
But you may want to consider modifying your design so you don't need to
get the rotation value from the mesh. You could store the angle in a
variable which you update each time you rotate the mesh.
Thomas Teufel wrote:
> Sorry, "xxx" should mean: iMeshWrapper object
>
> Thomas Teufel wrote:
>
>>Jorrit Tyberghein wrote:
>>
>>
>>>One float is not sufficient to represent a rotation. i.e. you can
>>>rotate around x, y, and z axis so you need at least three floats.
>>>
>>
>>Yes, that's absolutely clear to me.
>>I just meant that I only need to get one of those three angles.
>>
>>I think you didn't really understood my point.
>>The case is that I have a xxx.
>>And by using GetTransform() or something else
>>I want to get to know the rotation around the x axis as a float value.
>>
>>I hope you know what I mean?
>>
>>Greetings,
>>Thomas
>>
>>
>>>Greetings,
>>>
>>>On 3/10/07, Thomas Teufel <[EMAIL PROTECTED]> wrote:
>>>
>>>
>>>>Hello,
>>>>
>>>>I guess my problem is not that difficult but I really don't know how to
>>>>solve it.
>>>>
>>>>I need to figure out the rotation of a mesh object. The result should be
>>>>a float value.
>>>>
>>>>I tried it with csReversibleTransform. But I didn't find a solution to
>>>>get a float value from this.
>>>>
>>>>
>>>>Thanks in advance,
>>>>Thomas
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Crystal-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-main
Unsubscribe: mailto:[EMAIL PROTECTED]