Jump to content

Time stepped animation possible?


Recommended Posts

Weird question I know... Not sure what the correct terminology is here, but I'm looking to have a model change it's shape based on a long time period that has past since it was first activated. I also want to have control of the models state so if the scene was unloaded, I can note where it was. If the scene was reloaded, the model gets set at the correct stage to be where it should be in the animation, based on time past outside the scene.

I'm not sure if I even need to generate an animation  - It would only run once for each instance of the object spawning , so no looping / reversing of animation.

An idea I had would be to have multiple copies in my model across different layers and have the mod manage which "layer /frame" is visible after determining how long it's been since the object was initiated. Can you do this with animations in KSP? (ie set a specific frame)

 

Link to comment
Share on other sites

HI. i suppose the first question should be, what are you trying to do?  There are many ways to do things in KSP but a lot of what you can do depends on what the object is, with reference to modules etc

KSP animation modules are fairly basic and only suited to fairly simple animations.

Sounds more like you'd need some kind of procedural part, some code to keep it persistent, and a lump of code to change the model based on whatever scale you set , But this all swings on what you are trying to do.

 

Link to comment
Share on other sites

Thanks @SpannerMonkey(smce)

I'm doing a solar flare / SME mod where a "cloud" of material get ejected from Kerbol and fires off into the distance. I'm detecting if anything is within the area of the SME "cloud" that I'm tracking and will be later adding code to affect craft due to the solar flux affecting electrical systems. I'm still deciding what effects to have - having batteries lose all charge is the one at the top of the list, but I've got other ideas I'm looking to implement.

 I have to delve into background processing though, seeing as a lot of this stuff would be seen in the map view - so that's going to be a fun exercise to learn. I'll probably lean a fair bit on how the Kerbalism mod handled their background stuff.

Anyway, back to the modelling - I've got the Flare process working and have a SME sphere shoot out from the sun at random periods and inclinations. I've manage to incorporate some solar cycle maths and long period cycles written in some sci papers on a formula for our Suns own process. I even managed to model equivalent sunspots to allow a player to do some predictions if the want to reverse engineer the maths I used without looking at the source code.

However, I thought it would be nice if the area of the SME "cloud" changes shape and goes from an initial sphere and slowly morphs into in arc-ish thing. (think of two overlapping spheres but slightly offset. I'd boolean out one of from the other and end up with a rough bowl / 3d arc shape. While I could just have it be represented by a sphere primitive for it's entire life cycle, I was looking to see what I'd need to do to have this slow motion change of shape take effect.

The final shape would be something like the below (picture not relavent to mod - only there to give an idea on shape and grabbed at random from the internet).  So the flare would have the two spheres that are closer to the same size and deeper inset. I'd use this method (using spheres) so that detecting if something is within the "flux" (and thus get affected) would be as easy as seeing if a craft was within the radius of the first flare sphere, but not in the negative sphere that was cut way..

3dsMax_Boolean_Decimation.gif

Catch is, I've never 3d modelled stuff so I've still got to learn that (same for animations). This  question is from me trying to work out what I need to learn to bring the change of shape about.

I first thought animation, but I thought the KSP animation abilities was mainly for animating little part deployments and probably wasn't capable of what I needed. However, if I can freeze an animation at a certain point and have the code decide when it moves to the next frame, I'd get the same effect that I wanted.

Reason I think KSP animation "might" be usable as-is, is because the Stock cargo bay has an opening animation, but the player can set it manually to a certain value via a tweakable slider. I figure, if I had an animation with something similar, I could set the value / animation frame via the plugin code and hide any manual interface from the UI. 

Back to the time stepped stuff. The goal is I want to load the model at a certain point in it's animation depending on how far it is from the sun and compared to it's max distance, where it'd be too dispersed to bother with. I also need to be able to load the model from a save point, and I figure if I know the distance, then I know what it should "look like" at that point and set the frame in the animation automatically. This is why I want to control the animation from the plugin and not just "hit play" and then let it cycle through it's frames.

Does that help with what I'm looking for at all? Sorry if it sounds a bit lost / all over the shop. Still learning what I need to do.

Edited by wile1411
Link to comment
Share on other sites

On 1/5/2018 at 6:19 PM, wile1411 said:

If I ignored the planetary aspect, is there way to set an animation frame?

Through custom plugin code -- yes.  You can pause an animation at any given frame, or set it to an arbitrary point in its animation timeline.

Sounds like what you are doing should be doable, but will require some custom plugin code.  Unity documentation on the Animation component used by KSP -- https://docs.unity3d.com/ScriptReference/Animation.html

 

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...