Problem with Turntable Animation
#1
Posted 09 September 2017 - 09:20 AM
I have built a model of a turntable that I am trying to animate with no success.
The model was created in Blender and I have set up the hierarchy so that there are basically three components. The object I call "MAIN" which is the square pier upon which the table is supported, an object I call "Pit", which includes the base, the perimeter walls and the rail and ties for the table, and an object I call "Table", which is the part that should rotate. In Blender, when I grab the item I call Table, all of the components rotate together within the pit as desired. I exported the model to an MSTS shape file and added the following animation code:
animations ( 1
animation ( 3600 30
anim_nodes ( 1
anim_node Table (
controllers ( 1
tcb_rot ( 3
slerp_rot ( 0 0 0 0 1 )
slerp_rot ( 1800 0 0.9999822 0 5.95526E-03 )
slerp_rot ( 3600 0 0 0 1 )
)
)
)
)
)
)
When I open the model in shape viewer and animate it the entire model is rotating. I have read the previous posts about animating turntables and thought that I understood what needed to be done, but obviously I don't. I did search around for a detailed guide on animating models but so far have only found bits and pieces so I am simply "cold copying" that code into the file.
Certainly not my preferred way of doing such things. Can someone please help?
Paul http://www.elvastower.com/forums/public/style_emoticons/default/biggrin.gif
P.S. Does anyone know of a good, detailed guide on the code in shape files that deals with animation?
#2
Posted 09 September 2017 - 10:02 AM
#3
Posted 09 September 2017 - 12:05 PM
#4
Posted 09 September 2017 - 12:19 PM
IIRC, any Objects that are "children" of MAIN, become part of MAIN in the .s file.
What I've done for years is make a second "main" that I name Mn2 and make a child of MAIN
Then all other objects are made children of Mn2 and they remain separate.
In the case of the Turntable, the hierarchy would be:
MAIN
...|--Mn2
........|--Pit
........|--Table
HTH . . .
#5
Posted 09 September 2017 - 02:11 PM
Quote
Jared,
That certainly seems to be what is happening.
Here is the hierarchy as it shows in Blender:
'MAIN' is the parent and 'Pit' and 'Table' are the children. In Blender if I rotate 'MAIN' both 'Pit' and 'Table' rotate with it. But if I rotate 'Pit' or 'Table' they each move alone and the other two elements remain static. So in the model the hierarchy is is working correctly. It seems that something is happening in the export.
It seems to make no difference whether I apply the animation to 'MAIN' or to 'Table'. In either case the entire model rotates.
Tom,
I tried your suggestion, it sounded like a good idea, but it made no difference. http://www.elvastower.com/forums/public/style_emoticons/default/sad.gif
P.S.
Tom,
I hope your presence on the site is an indicator that your wife is doing well. I will continue to keep her in my prayers.
#6
Posted 09 September 2017 - 02:28 PM
Maybe this is getting too complicated. I have many successful turntable installations
with all stationary parts non-grouped under Main. All movable parts in a group called Wheel1 and a child of Main.
This is compiled to the .s using 3DCrafter but should make no difference how one gets to the .s
I suspect that the problem is with the animation code. Here is what 3DC generates.
animations ( 1
animation ( 3599 30
anim_nodes ( 2
anim_node MAIN (
controllers ( 0
)
)
anim_node WHEEL1 (
controllers ( 2
tcb_rot ( 5
slerp_rot ( 0 0 0 0 1 )
slerp_rot ( 900 0 -0.7071068 0 0.7071067 )
slerp_rot ( 1800 0 1 0 -1.629207E-07 )
slerp_rot ( 2700 0 0.7071066 0 0.7071069 )
slerp_rot ( 3600 0 0 0 1 )
)
)
)
)
)
)
)
Note that there are two animation nodes. One with no actual animation MAIN and second actual animation WHEEL1 .
The first animation node is missing in Paul's code example. Trim the turntable back to a Main and Wheel1, compile
to an .s, then append the above code to the end of the .s .
Mike
Sandy River Tom, on 09 September 2017 - 12:19 PM, said:
IIRC, any Objects that are "children" of MAIN, become part of MAIN in the .s file.
What I've done for years is make a second "main" that I name Mn2 and make a child of MAIN
Then all other objects are made children of Mn2 and they remain separate.
In the case of the Turntable, the hierarchy would be:
MAIN
...|--Mn2
........|--Pit
........|--Table
HTH . . .
#7
Posted 09 September 2017 - 04:33 PM
I got it to work... http://www.elvastower.com/forums/public/style_emoticons/default/yahoo.gif In shape viewer... http://www.elvastower.com/forums/public/style_emoticons/default/unsure.gif Testing it in-sim is yet to come.
I got Blender to generate animation code in the shape file by adding a bone to the model and using it to define the rotation. But there was an additional catch. When I added the bone its longitudinal axis was vertical. I thought OK I want to rotate about that axis. But the vertical axis of the model is Z and the longitudinal axis of the bone is Y. Since the axes didn't match, when I tried to rotate the table about the Z axis it wouldn't work. So I had to rotate the bone 90 degrees to get its Z axis vertical. Once the axes matched I could do the rotation and define the animation in the model and export it. Simple, Huh? http://www.elvastower.com/forums/public/style_emoticons/default/ko2.gif It still didn't rotate properly on initial export but I edited the code lines to match the OR sample and voila, rotating smooth as silk.
Thanks guys for your help. Now the next step, get it into the sim. http://www.elvastower.com/forums/public/style_emoticons/default/mellow.gif
What a nice relaxing hobby! http://www.elvastower.com/forums/public/style_emoticons/default/tongue.gif
#8
Posted 10 September 2017 - 11:13 AM
#9
Posted 10 September 2017 - 04:03 PM
#10
Posted 12 September 2017 - 10:16 PM