Jump to content

Changing the animation speed of a part


Enceos

Recommended Posts

I believe I've seen a centrifuge / hab ring with a tweakable animation speed in editors. Would anyone please remind me the name of the mod?

Or any other mod which is capable of changing the animation speed of parts on the fly.

Edited by Enceos
Link to comment
Share on other sites

5 minutes ago, kerbiloid said:

Any propeller mod

Yep, I know Firespitter does it, but there's no animation speed tweakable in the VAB. I believe I've seen something in Kerbalism, need to check it out.

Edited by Enceos
Link to comment
Share on other sites

@linuxgurugamer Can lend you some help on this one @Enceos. He has re-written the FTLContinued mod for some animated models I made. His code drives the animated part at a varying speed dependent on variables for each situation. The important bit is that he slowed the original model animation to about a tenth of the original speed and then speeds it up, all that is done in his part module.

Link to comment
Share on other sites

@Enceos

If you aren't 'stuck' with using a traditional animation, SSTU might have something that would work.  I use it for variable speed rotation on centrifuge parts.  The catch is that it doesn't use an 'animation', but spins the transform through code (less overhead, and no dealing with the 'looping' bit).  It can even be configured to only be spinnable when a secondary animation has already played (e.g. can only spin after deployed).  Second catch is that it was designed for centrifuge parts so it currently includes a 'gravity force' display value.

https://github.com/shadowmage45/SSTULabs/blob/master/Source/WIPModule/SSTUAnimateRotation.cs

 

Link to comment
Share on other sites

7 minutes ago, Enceos said:

@Shadowmage Thanks for thinking on the matter. I have two rotating meshes in my animation, one is a planet and the other is an orbital plane. Can your module rotate the orbital plane while the planet is spinning?

Yep.

It was built for centrifuges, so it has a main transform for the centrifuge, and a secondary transform for the 'countermass'.

public string transformName; // the primary rotating transform
public string secondaryTransformName; // the secondary rotating transform
public float rpm = 1;// the default rpm of the primary rotating transform
public float secondaryRotationMultiplier = 1f; // the speed of the secondary as a ratio to the speed of the primary; set to negative value to invert rotation direction


One other 'gotcha' -- as it was designed for centrifuges it has a currently pre-set user-adjustable rpm range of 0-10rpm.  If you want to file a github-issue on the SSTU repository regarding it I can look into config-specified min/max values, as well as a boolean to enable/disable the display of the gravity (as it is not needed for your purposes).

Edit:  Ohh, and rotation axis can be specified with:

public Vector3 rotationAxis = Vector3.forward;
public Vector3 secondaryRotationAxis = Vector3.forward;

 

Edited by Shadowmage
Link to comment
Share on other sites

2 minutes ago, Enceos said:

@Shadowmage Is the module present in the current SSTU tools? How heavy is it on the system, if I run 10 instances at a time for example?

Yes, and negligible.  You could probably run a few thousand of them without noticeable impact (although this depends on if there are colliders attached to the rotating parts; animating colliders causes some physics overhead).

 

Edit: Examples of the module in-use in a part config: 

https://github.com/shadowmage45/SSTULabs/blob/master/GameData/SSTU/Parts/StationCore/ST-CFG/ST-CFG-A.cfg#L253-L264

either remove the 'animationID' line, or set it to -1 if you are not using any 'deploy' animation....

Edited by Shadowmage
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...