Jump to content

need help on playing animation with switching a module format


Jiraiyah

Recommended Posts

Hi everyone, I took an old model from forums, I tend to use it as a radial mounted rapier engine that has built in air intake, take a look:

a5b2c4556f4a4633af4299bdf4772cf3.png

as you see, those three small fins has animation on them, now, how can i use this model in a way that when we switch the mode on a rapier engine, they will open and close and provide air intake?

I am totally new to ksp modding, i don't even know how to play those animations in ksp yet, please someone help

thanks

Link to comment
Share on other sites

 

OK, to get the animation from Unity into KSP, you'll need to make sure it's a Legacy animation in Unity. Give it a meaningful name, since you'll need to put the name into the KSP part's CFG file. You will of course have to export the part using Part Tools to make a "mu" model file for KSP.

 

The simplest way to make a functioning animation in KSP, is to use ModuleAnimateGeneric. The "animationName" variable is where you assign the animation name that you made in Unity.  Everything else in the module can be set to your preference. Example:

 

	MODULE
	{
		name = ModuleAnimateGeneric
		animationName = doors
		startEventGUIName = Close Doors
		endEventGUIName = Open Doors
		actionGUIName = Toggle Bay Doors
		allowDeployLimit = true
		revClampDirection = false
		revClampSpeed = true
		revClampPercent = true	
	}

 

I'm not sure if there's a simple way to make an air intake activate and deactivate with the animation. One possibility is to create independent colliders for those doors, and put the intake transform behind them, so that when the doors are closed, the intake transform is blocked. I don't know if this works or not, with the colliders in the same KSP part. But it's worth trying. Engine thrust transforms can be blocked by collider meshes in the same part, so I'd imagine that intakes can function the same way.

 

Link to comment
Share on other sites

@NecroBones

 

5 minutes ago, NecroBones said:

 

OK, to get the animation from Unity into KSP, you'll need to make sure it's a Legacy animation in Unity. Give it a meaningful name, since you'll need to put the name into the KSP part's CFG file. You will of course have to export the part using Part Tools to make a "mu" model file for KSP.

 

The simplest way to make a functioning animation in KSP, is to use ModuleAnimateGeneric. The "animationName" variable is where you assign the animation name that you made in Unity.  Everything else in the module can be set to your preference. Example:

 


	MODULE
	{
		name = ModuleAnimateGeneric
		animationName = doors
		startEventGUIName = Close Doors
		endEventGUIName = Open Doors
		actionGUIName = Toggle Bay Doors
		allowDeployLimit = true
		revClampDirection = false
		revClampSpeed = true
		revClampPercent = true	
	}

I'm not sure if there's a simple way to make an air intake activate and deactivate with the animation. One possibility is to create independent colliders for those doors, and put the intake transform behind them, so that when the doors are closed, the intake transform is blocked. I don't know if this works or not, with the colliders in the same KSP part. But it's worth trying. Engine thrust transforms can be blocked by collider meshes in the same part, so I'd imagine that intakes can function the same way.

 

hmm do you think it would be easier to use coding? i'm not afraid of getting my hands dirty in that aspect but may need a code snippet or two from already existing mods that do this, i remember i had seen parts with animations for air intake also i'm fairly sure for doing the animation in combination with rapier switch either i have to have a separate button so that i can use it in action group or i need to do it via code and i think in both cases i need to code? question is, can you point me any good repo online doing it in code?

thanks

Edited by Jiraiyah
Link to comment
Share on other sites

3 minutes ago, Jiraiyah said:

@NecroBones

 

hmm do you think it would be easier to use coding? i'm not afraid of getting my hands dirty in that aspect but may need a code snippet or two from already existing mods that do this, i remember i had seen parts with animations for air intake also i'm fairly sure for doing the animation in combination with rapier switch either i have to have a separate button so that i can use it in action group or i need to do it via code and i think in both cases i need to code? question is, can you point me any good repo online doing it in code?

thanks

 

It should be possible to customize how your parts function with mod code, yes. I don't have any repo information since I don't code for KSP mods (I just make parts), but someone else here might be able to help on that one.

 

Link to comment
Share on other sites

Just now, NecroBones said:

 

Hey great! Glad it's working, so far. :)

well i tested the collider, either i did something derpy or it did fail, well, the air intake module has an option for breaking the air intake but the animation is not tide to the animation at all and closing the gap won't affect the amount of air intake i am afraid take a look, first with the doors closed

82c5c0ca578f404295f9ec9df865c182.png

Now I open the doors

91d3be9fb6c043e5a0638356ef3d90dd.png

as you can see, there is no significant change in the air flow

Link to comment
Share on other sites

4 hours ago, NecroBones said:

 

Yeah, it might need some custom code then, for toggling the intake on/off.

can we make a built in moduleResourceIntake via code? if that is possible, then it should not be that hard is it?

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