|
Hi,
First time post. Question for everyone:
I am reading in motion data from a while through maxscript. I create a dummy for each object moving, and then read in time data, position data and rotation data for a given time segment. The data looks like this…
t[s] x [ft] y [ft] z [ft] phi1[deg] phi2[deg] phi3[deg] vx[mph] vy[mph] vz[mph]
0.000 233.04 633.51 2.02 0.00 0.00 0.90 37.00 0.58 0.00
0.100 238.46 633.60 2.02 0.00 0.00 0.90 37.00 0.58 -0.00
0.200 243.89 633.68 2.02 0.00 0.00 0.90 37.00 0.58 0.00
0.300 249.32 633.77 2.02 0.00 0.00 0.90 37.00 0.58 -0.00
We skip the last three velocity rows, and just deal with position and rotation.
I create a dummy object with a position of [0,0,0] and rotation of [0,0,0] to start with.
dummyName = CreateDummyName()
dummyObj = dummy pos:[0,0,0] rot:[0,0,0] boxsize:[1,1,1] name:dummyName
selectMore dummyObj
Once it’s selected, I think move to reading the transform data…
while not eof PccrashStream do
(
for node in selection do
(
readTransformData node
import_prog.value = 100.*(filePos PccrashStream)/EOFPosition
)
)
so we send the node in (which is the dummy) to this method…
function readTransformData obj=
(
tempLine = readLine PccrashStream
tempArray = filterstring tempLine “ “
if (tempArray[1] == “ “) then
(messagebox “No Data here")
else
(
Time = tempArray[1]
Frame = (tempArray[1] as float) * 30
--Position
VehPosition = copy obj.position
VehPosition.x = tempArray[2] as float
VehPosition.y = tempArray[3] as float
VehPosition.z = tempArray[4] as float
--rotation
VehRotationPart = copy obj.rotation
VehRotationPart.x = (tempArray[5] as float)
VehRotationPart.y = (tempArray[6] as float)
VehRotationPart.z = (tempArray[7] as float)
messagebox ("Before Time: “ + (Frame as string) + “ VehX: “ + (VehPosition.x as string) + “ VehY: “ + (VehPosition.y as string) + “ VehZ: “ + (VehPosition.z as string) + “ RotX: “ + (VehRotationPart.x as string) + “ RotY: “ + (VehRotationPart.y as string) + “ RotZ: “ + (VehRotationPart.z as string))
at time Frame animate on obj.rotation = VehRotationPart
at time Frame animate on obj.position = VehPosition
messagebox ("After Time: “ + (Frame as string) + “ VehX: “ + (VehPosition.x as string) + “ VehY: “ + (VehPosition.y as string) + “ VehZ: “ + (VehPosition.z as string) + “ RotX: “ + (VehRotationPart.x as string) + “ RotY: “ + (VehRotationPart.y as string) + “ RotZ: “ + (VehRotationPart.z as string))
)
)
So we read the data in, assign it to these objects and then on the “at time Frame animate” lines, we make the keyframes. All fine and dandy.
Position works fine. The “Before Time” and “After Time” boxes show the correct data, and then when we double check the keyframes, the X,Y,Z positions are all correct for all times.
However, rotation is another matter. The rotation data should be [0,0,.9] (we’re going to disallow radian vs degrees at this point as we can make that conversion easily) for the 4 points listed. However:
We should get: We actually get:
---------------------- ----------------------
[0,0,.9] [0,0,83.974]
[0,0,.9] [0,0,100.895]
[0,0,.9] [0,0,100.895]
[0,0,.9] [0,0,100.895]
Further down the line, the actual data changes values, never going above 1 in X, 3 in Y and -10 in Z.. In the data we see in the keyframes, we get values that change a max of 100 down to about 8 in the Z value. These changes do not happen to correspond with the changes in the actual data either. As you can tell from the example above, the actual keyframe changes when the data does not.
One thing to add: I have tried to put in the rotation values as 0. That causes the data to be 0, and the keyframes to be 0 as well. So it appears that having a value for data causes it to get changed, but having all 0’s causes no change.. (or 0 * something = 0)
I’ve ruled out some sort of normalization (as the changes in keyframe data don’t change the same as the actual data) and I’ve ruled out conversion things… I’ve also ruled out the data getting changed as my Before Time: message box matches my After Time: message box.
Something is changing when the data is keyframed, and I have no clue why. Any thoughts?
Thanks.
Rich
|