Animation Question

That one was relatively simple <!– s;) –><img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink" /><!– s;) –> especially when someone finds the formula for you.

I’ve been stuck on my pipe building addon for ages – I have to apply andquot;shearandquot; to each end section depending on the angle difference between the sections (or rather pairs of joined sections) so the pipe doesn’t andquot;leakandquot; <!– s:) –><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!– s:) –>

That equations page will also help massively with my piston/rod builder andamp; animator.

Regards

Paul

Let’s say you are building an engine that requires some testing of pivot point location to get things articulating correctly. Then, just for fun, let’s say you move a MAIN pivot point (Shift operation) forward or backward. Now one key of the animation changes, but the other 8 don’t. The other keys of the drivers and rods don’t come along with the first key, so you get a jumping effect for animation keys 1-8. Am I doing something wrong when I shift the frame? Is there a better method? Can you somehow apply that shift to all the frames, not just the initial (animation key 0)

If not, would it be possible to use a script to change the values of all 9 animation keys? For example.. Select a driver. Run the script. Enter value to be changed (ie… z-axis=1.202) All z-axis values are changed for each animation key on that driver to z-axis=1.202.

What I did was click each animation key, copy and paste to each driver/rod for each frame. andnbsp;I imagine there has to be a better way. andnbsp;I just don’t know it yet.

Yeah! I discovered this one the hard way as well! …….. Did a normalise groups after starting animation work. BIG MISTAKE! LOL ::)

But given that this is about your articulated locomotive, why don’t you experiment with the articulation points before adding the animation?? andnbsp;Is there some reason the animation needs to be in place before you do that??

Best Regards,
Julian (Fozzy The Bear)

You ever try running a steam engine without animation? IT STINKS! 8)

Hey, Paul andamp; Julian, what has become of your frame rate experiments? I am really interested. Are there some preliminary suggestions/results yet?

I had similar problems recently – and yep a plugin/script could do this easily enough.

Regards

Paul

90 degrees is smooth, key frames are just used for interpolation of the rotation, MSTS calculates the exact position according to the time.

16 key frames is used to stop the piston rods bouncing (interpolation is not smooth), but causes other side effects in the ENG file – I’m hoping to be able to get around this soon.

(Though the animation in the S file shows 8 keyframes at 30fps – could these be changes to 16 at 60fps to make it run the same as if it were 8 frames???)

Regards

Paul

Richard, could this be a function of the software, rather than a plug-in? Please don’t think I am being critical. This is certainly not meant that way. Even the first version of 3dC that I used 3.7(?) is 10 times better than TSM. But, it seems like if you are not in the animation screen, and you make a change, that change should apply to all animation keys? OR are we the exception, and most other users want it ,to work the way it does?

dang! it happened to me again today…

it’s my MSTS Engineer plugin adding all the animations, then I wanted to move the con rod to an outside frame position.

A small plugin is in order…

Is it only position shifts we’re interested in?
The plugin should set all animation positions for a selected object to the same as the current selected object position – would that do?

Regards

Paul

When you shift an object, everything remains animated, as far as rotations go, so the biggest issue seems to be x,y,z coordinates. Is that a correct statement?

I realized that my wheels were a little too high above the rails and had to shift my main pivots, so I then had the fun task of andquot;copy and pasteandquot; all the y coordinates for every driver, etc… It took a while to go through all the frames. Imagine if I quarter the engine, like Julian. 12 drivers! Oh the humanity! 12 x 18 = 216 positions to set. And I use a andquot;pretend wheelandquot;; [b:zazpiv5k]Wheels5[/b:zazpiv5k], set as something stationary to animate some of the more stationary parts. so add another 2 x 18 = 36 to the equation.

I wish I knew how to write these things. While we’re on the subject, how about a andquot;copy and pasteandquot; script that pulls the rotational info from a selected object, then applies that rotational info to a new object? Like a driver. Instead of going through each frame, couldn’t we just set up one wheel, then apply that info to all the others. Is that too complicated? Is it already possible? I see a andquot;move andquot; andamp; andquot;copyandquot; function on the little animation dots when I right-click. But it doesn’t andquot;paste.andquot; What does it do?

Paul, it is very kind of you to try to work these things out. andnbsp;Apparently a few of us have found this to be one of the difficulties of steam engines. andnbsp;Not that it is not all worthwhile in the end! andnbsp;But, thank you. andnbsp;Your work makes the program so much easier to use.

Not quite so simple as I thought…

I have a script that adjusts all the key frame positions <!– s:) –><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!– s:) –>

but

It also sets all the orientations to zero <!– s:( –><img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad" /><!– s:( –>

Now if I can get a good algorithm to convert Quaternions into Dir/Up Normalized Spherical polar coordinates I can keep the same animation orientations… <!– s;) –><img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink" /><!– s;) –>
([img:2d836vk7]http&#58;//astronomy&#46;swin&#46;edu&#46;au/~pbourke/analysis/quaternions/[/img:2d836vk7]
<!– m –><a class="postlink" href="http://astronomy.swin.edu.au/~pbourke/analysis/quaternions/">http://astronomy.swin.edu.au/~pbourke/a … aternions/</a><!– m –>
)

Regards

Paul

If it is just wheels/rods we’re interested in here, my Engineer plugin already has the code to animate them, it would be a matter of extracting the code. (and adding a few more parameters)

A few more tips…
You don’t need to define all 9 key frames in your set – 5 at 90 degrees in frames 0,2,4,6 andamp; 8 will do the trick as well

Quartering – make the wheels on one side a sub-group of the wheel on the other and rotate it by 90 degrees – automatically quartered.

Make connecting rods sub groups of the rear wheel group, pivoting around the connection to that wheel – then animate with the reverse angle to the wheel so it remains horizontal.

This is how my Engineer plugin builds the wheels – try a simple test build with animation and have a look at the wheel and rod group animations.

12 quartered drivers and 2 rods would make 6*5+2*5 = 40 positions to change

A copy and paste rotations script would be useful, but suffers from the same Quaternion/polar coord conversion problem <!– s:( –><img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad" /><!– s:( –>

Paul

Whilst I’m here I might as well post the script code to re-set the positions for all animations…
Beware, it currently removes rotations, but all the positions will be correct

Just copy and paste this code into the edit script window (Pro version) and save it – beware of long lines that wrap round, I think there’s only one – andquot;Reply = andquot;

[pre class=’ip-ubbcode-code-pre’]
Language = VBScript

‘*********************************************************************************
‘ Purpose: Set all animation positions to the current selected object position
‘*********************************************************************************

Option Explicit ‘require variable declarations

Sub Main (3DCApp)

Dim Scene,Object,Group,GP,Tim
Dim ActiveObjectCount
Dim X,Y,Z,I
Dim PX,PY,PZ
Dim Reply

‘get the scene
Set Scene = 3DCApp.GetActiveScene

‘get the active object count
ActiveObjectCount = Scene.GetActiveObjectCount

‘only proceed if there is an active object
If ActiveObjectCount = 0 Then
MsgBox andquot;Please select an object.andquot;
Else
Set Object = Scene.GetActiveObject(0)
Set Group=Object.GetParentGroup()
Set GP=Group.GetParent()
Reply=msgbox(andquot;Set all key frame positions for Group andquot; andamp; Group.GetName() andamp; andquot; to the current position? (no undo available)andquot;,vbYesNo)
if Reply=vbYes then
Group.GetPosition GP,X,Y,Z
For I=0 to Group.GetPositionKeyFrameCount()-1
Group.GetPositionKeyFrame I,Tim,PX,PY,PZ
Group.SetPosition GP,Tim,X,Y,Z
Next
End If
End If
End Sub
[/pre]

]]Quartering – make the wheels on one side a sub-group of the wheel on the other and rotate it by 90 degrees – automatically quartered

You’re right, of course. andnbsp;It is the rods that get tricky. andnbsp;At least the positions are the same, just 2 frames different.

You made a comment about using 90 degree animation keys. andnbsp;Is that as smooth as 9? I even read where some people were doubling that amount due to jerky animation. andnbsp;I am interested to see how that works.

Anyone else try 90 degree animation?

nwfan (nw_fan?),

Try this url,

[img:15rupvoe]http&#58;//skal&#46;planet-d&#46;net/demo/matrixfaq&#46;htm[/img:15rupvoe]
<!– m –><a class="postlink" href="http://skal.planet-d.net/demo/matrixfaq.htm">http://skal.planet-d.net/demo/matrixfaq.htm</a>&lt;!– m –>

]]nwfan (nw_fan?),

Yep, one and the same. I thought about updating my signature here to look more like Train-Sim.

]]Try this url,
]]http://skal.planet-d.net/demo/matrixfaq.htm

Wow. A little… actually a lot over my head, but I’m starting to pick up some programming, so maybe Ill be writing some of these scripts someday. Thanks for the link.

nwfan, your logo gave you away <!– s:) –><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!– s:) –>. Actually it’s a little over my head too.

PaulGausden , I read that the conversion from quaternion andquot;spaceandquot; isn’t guaranteed to be unique. MSTS wheel and rod linkage rotation is always about the X axis (unless you are animating other objects). I wonder if constraining the equations to X only rotations would guarantee uniqueness?

You must be logged in to reply in this thread.

21 posts