How to rotate camera when I have 4 asin and acos values?

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
grzybu
Posts: 0
Joined: Wed Aug 04, 2004 8:40 am
Contact:

How to rotate camera when I have 4 asin and acos values?

Post by grzybu » Mon Jan 21, 2008 10:03 pm

Hi,

I'm trying to import camera animation from Max to blender using xaf file.
Translation is easy, but don't know how to rotate camera.
I have asin and acos values but how to know if it's value for 0-pi/2, pi/2-pi or more?

Here are parts of xaf file with data:

Code: Select all

<S t="0" v="1.000000 0.000000 0.000000 0.000000 -0.000000 1.000000 0.000000 -1.000000 -0.000000 0.000000 0.000000 0.000000" />
<S t="192" v="0.984808 0.173648 0.000000 0.000000 -0.000000 1.000000 0.173648 -0.984808 -0.000000 0.000000 0.000000 0.000000" />
<S t="384" v="0.939693 0.342020 0.000000 0.000000 -0.000000 1.000000 0.342020 -0.939693 -0.000000 0.000000 0.000000 0.000000" />
<S t="576" v="0.866025 0.500000 0.000000 0.000000 -0.000000 1.000000 0.500000 -0.866025 -0.000000 0.000000 0.000000 0.000000" />
<S t="768" v="0.766044 0.642788 0.000000 0.000000 -0.000000 1.000000 0.642788 -0.766044 -0.000000 0.000000 0.000000 0.000000" />
<S t="960" v="0.642788 0.766044 0.000000 0.000000 -0.000000 1.000000 0.766044 -0.642788 -0.000000 0.000000 0.000000 0.000000" />
<S t="1152" v="0.500000 0.866025 0.000000 0.000000 -0.000000 1.000000 0.866025 -0.500000 -0.000000 0.000000 0.000000 0.000000" />
<S t="1344" v="0.342020 0.939693 0.000000 0.000000 -0.000000 1.000000 0.939693 -0.342020 -0.000000 0.000000 0.000000 0.000000" />
<S t="1536" v="0.173648 0.984808 0.000000 0.000000 -0.000000 1.000000 0.984808 -0.173648 -0.000000 0.000000 0.000000 0.000000" />
<S t="1728" v="0.000000 1.000000 0.000000 0.000000 -0.000000 1.000000 1.000000 -0.000000 -0.000000 0.000000 0.000000 0.000000" />
Last three values are translation.
In file there is also euler tranform but there are four parameters:

Code: Select all

<Controller name="Camera \ Transform \ Rotation" classOf="Euler XYZ" classID="2012,0" superClassID="900C" subNum="1" numChildren="3" filterType="rot" outOfRangeBefore="constant" outOfRangeAfter="constant" eulerOrder="XZY" eulerRotatingFrame="true">
<Samples count="10">
<RVal t="0" v="-0.707107 0.0 0.0 0.707107 " />
<RVal t="192" v="-0.704416 -0.061628 -0.061628 0.704416 " />
<RVal t="384" v="-0.696364 -0.122788 -0.122788 0.696364 " />
<RVal t="576" v="-0.683013 -0.183013 -0.183013 0.683013 " />
<RVal t="768" v="-0.664463 -0.241845 -0.241845 0.664463 " />
<RVal t="960" v="-0.640856 -0.298836 -0.298836 0.640856 " />
<RVal t="1152" v="-0.612372 -0.353553 -0.353553 0.612372 " />
<RVal t="1344" v="-0.579228 -0.405580 -0.405580 0.579228 " />
<RVal t="1536" v="-0.541675 -0.454519 -0.454519 0.541675 " />
<RVal t="1728" v="-0.500000 -0.500000 -0.500000 0.500000 " />
</Samples>
I thought there will simple quaternions or euler transforms with 3 parameters but now I'm confused.
I believe solution is really simply, I'm just to dumb to see it ;)

Post Reply