Jump to content

[WIP][1.8.x-1.12.x] KSP Secondary Motion [v0.1.1]


Icecovery

Recommended Posts

logo.png

KSP Secondary Motion adds secondary physics motion to some stock antennas and solar panels, it also added some brand new parts to the game.

This mod is still working in progress, the APIs are subject to change.

Review by @Kottabos

Stock Modification

Stock Solar Pannel
Honeycam%202020-07-15%2001-04-07.gif

Stock Antenna

Honeycam%202020-07-15%2000-53-19.gif?raw=true

Check high frame rate high-resolution mp4 version here

New Parts

NewAntennas.png

NewAntennas_2.png

FunParts.png

Honeycam%202020-07-15%2003-55-03.gif?raw=trueHoneycam%202020-07-02%2023-35-28.gif?raw

 

Features:

Wobbling antennas and solar panels

Real-world used ground antennas

CREW Duke Anti-IED system (BDArmory support, works as a jammer)

TweakScale support

A plunger

Wacky Waving Inflatable Arm Flailing Tubemen

Pickle Rick!

 

How to Use:

Generally, there is no need for the user to adjust settings, but if you don’t like the wiggliness of a certain part, you can adjust the Damper Ratio and the Spring Ratio in the right-click menu of that part. 
The current version of the mod also has a Failsafe Activate Range slide bar in the right-click menu, if you find that the part behaves abnormally during the flight (such as flashing), you can increase the value to reduce or eliminate the effect. I am currently trying to fix this behavior, it is related to KSP's Floating Origin and Krakensbane, this option will not in the v1.0 release if the problem is addressed. Help and suggestions for fixing this problem are welcome.

 

Part List: 

Stock:

    Gigantor XL Solar Array

    Communotron 16

    (I am having difficulties with adding secondary motion to other stock antennas, solar panels, and radiators. That may change before the 1.0 version.)

New:

    APX-50 HF Mobile Whip Antenna (4 sections, 5m)

    APX-50 HF Mobile Whip Antenna (2 sections, 2.6m)

    APX-50 HF Mobile Whip Antenna (4 sections, 5m, Tied Down)

    AN/VLQ-12 CREW Duke

    AN/VLQ-12 CREW Duke Front Antenna

    CREW Duke Right Angle Adapter

    CREW Duke Structural Beam (1.6m, 1.25m, 0.63m, 0.37m)

    UHF727VM Multi-Band LTE Antenna

    VHF3088T Tunable Low Profile VHF Antenna

    VHF100512SLP VHF/UHF Low Profile Broadband Antenna

    Wacky Waving Inflatable Arm Flailing Tubemen

    The Plunger Antenna

 

Any suggestions and ideas about new parts are welcome.

 

Todo List:

This mod is still working in progress, check the todo list here

 

Modding:

If you are a mod creator and looking for adding secondary motion effects to your mod, the documentation is coming soon. It will be simple as adding two additional transforms to your part. The mod even allowed you to reconstruct the existing part hierarchy from a Module Manager script without re-exporting the part from unity (That's how I add the effect to stock parts). Note that the mod is still working in progress, the APIs are subject to change.

 

Changelog:

Spoiler

----------------------------------------
    v0.1.1 - 2020/09/25
    * For KSP 1.8.x - 1.10.x
    * Fixed improper theme name
----------------------------------------
    v0.1.0 - 2020/07/15
    * For KSP 1.8.x - 1.10.x
    * Initial release
----------------------------------------

 

Required Mod:

Module Manager (Not included)

 

Download:

Spacedock

Also available via CKAN

 

License:

KSP Secondary Motion was released under MIT License

MIT_logo.svg 

 

Source Code:

Github

 

Edited by Icecovery
still works in 1.12.x
Link to comment
Share on other sites

The motion of solar panels in a vacuum is a little surprising. Is there anything acting on the tips to create a retrograde moment?

Quick fix would be to have the size of motion scale with the atmospheric density variable.

Edit: just realised you could be going for transmission of vibrations from thrust assembly - if so my fix will stifle that too, perhaps even making it less realistic thanks to loss of atmospheric friction damping the movement on a craft travelling at a constant velocity. Maybe splitting animation parameters between jerk m/s3 (always on) and acceleration m/s2 (on +scaling in atmo)?

Edited by WhirlyBird
nuance
Link to comment
Share on other sites

On 7/26/2020 at 9:51 AM, WhirlyBird said:

The motion of solar panels in a vacuum is a little surprising. Is there anything acting on the tips to create a retrograde moment?

Quick fix would be to have the size of motion scale with the atmospheric density variable.

Edit: just realised you could be going for transmission of vibrations from thrust assembly - if so my fix will stifle that too, perhaps even making it less realistic thanks to loss of atmospheric friction damping the movement on a craft travelling at a constant velocity. Maybe splitting animation parameters between jerk m/s3 (always on) and acceleration m/s2 (on +scaling in atmo)?

Inertia and constant acceleration, right? ;)  If the panels are extended out on relatively slim structures, there'll be some flex when applying thrust. Maybe not so much as is illustrated.

Link to comment
Share on other sites

On 7/26/2020 at 12:51 PM, WhirlyBird said:

The motion of solar panels in a vacuum is a little surprising. Is there anything acting on the tips to create a retrograde moment?

Quick fix would be to have the size of motion scale with the atmospheric density variable.

Edit: just realised you could be going for transmission of vibrations from thrust assembly - if so my fix will stifle that too, perhaps even making it less realistic thanks to loss of atmospheric friction damping the movement on a craft travelling at a constant velocity. Maybe splitting animation parameters between jerk m/s3 (always on) and acceleration m/s2 (on +scaling in atmo)?

There is no animation involved in the spring motions, they are purely physics-based simulations. The method of implementation I used is just a hack compared to if you will simulate it in real life, you can check the source code for details. You can adjust the spring parameters in the part menu(if you enable the advance tweakable option in the game settings) to get the effect you prefer

On 8/1/2020 at 4:18 AM, lextacy said:

I think engine nozzle bells should flex. Could you code some of the engines to do that?

That will be pretty hard to implement on existing engines, that will require to turn the nozzle into a skinned mesh, bind bones and generate the skin weight table. But it is possible to make that happen on new engines that are specially modeled for adding this effect.

Link to comment
Share on other sites

  • 2 weeks later...

I wonder if this could be used to add aeroelasticity effects to wings (without having to separate them into tiny segments). Is the effect only visual, or does stuff like collider, nodes etc. move as well?

Link to comment
Share on other sites

47 minutes ago, m4ti140 said:

I wonder if this could be used to add aeroelasticity effects to wings (without having to separate them into tiny segments). Is the effect only visual, or does stuff like collider, nodes etc. move as well?

It seems like that would for-sure work for the larger one-piece wings. Otherwise, like you said, wings flex on their own in many cases :)

Link to comment
Share on other sites

  • 3 weeks later...

@Icecovery getting some errs in the log from this mod
speciifically

 

Spoiler

200906T103628.545 [ERROR] [ModuleManager.UnityLogHandle.InterceptLogHandler.LogFormat] Unable to find theme named:'Tan' in GameDB
200906T103628.546 [ERROR] [ModuleManager.UnityLogHandle.InterceptLogHandler.LogFormat] Unable to find theme named:'Black' in GameDB
200906T103628.547 [ERROR] [ModuleManager.UnityLogHandle.InterceptLogHandler.LogFormat] Unable to find theme named:'Olive' in GameDB
200906T103630.996 [ERROR] [ModuleManager.UnityLogHandle.InterceptLogHandler.LogFormat] Unable to find theme named:'Kerbal' in GameDB
200906T103630.997 [ERROR] [ModuleManager.UnityLogHandle.InterceptLogHandler.LogFormat] Unable to find theme named:'ickleRick' in GameDB

and 

200906T103729.194 [ERROR] [ModuleManager.UnityLogHandle.InterceptLogHandler.LogFormat] Module ModuleHierarchyReconstructor threw during OnLoad: System.InvalidOperationException: Sequence contains no matching element
  at System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x00011] in <fbb5ed17eb6e46c680000f8910ebb50c>:0 
  at KSPSecondaryMotion.ModuleHierarchyReconstructor.OnLoad (ConfigNode node) [0x001a4] in <416294fdcd3140efbb7e2db6f1e8e0b9>:0 
  at PartModule.Load (ConfigNode node) [0x001ab] in <c1858a3f77504bd1aaa946fdccf84670>:0 

 

full log: https://drive.google.com/file/d/1hTTXxsH6mRiKItAE7v1c3F3JcFFBBVJu/view?usp=sharing

Link to comment
Share on other sites

  • 3 weeks later...
On 9/6/2020 at 11:35 AM, Stone Blue said:

@Icecovery getting some errs in the log from this mod
speciifically

 

  Hide contents


200906T103628.545 [ERROR] [ModuleManager.UnityLogHandle.InterceptLogHandler.LogFormat] Unable to find theme named:'Tan' in GameDB
200906T103628.546 [ERROR] [ModuleManager.UnityLogHandle.InterceptLogHandler.LogFormat] Unable to find theme named:'Black' in GameDB
200906T103628.547 [ERROR] [ModuleManager.UnityLogHandle.InterceptLogHandler.LogFormat] Unable to find theme named:'Olive' in GameDB
200906T103630.996 [ERROR] [ModuleManager.UnityLogHandle.InterceptLogHandler.LogFormat] Unable to find theme named:'Kerbal' in GameDB
200906T103630.997 [ERROR] [ModuleManager.UnityLogHandle.InterceptLogHandler.LogFormat] Unable to find theme named:'ickleRick' in GameDB

and 

200906T103729.194 [ERROR] [ModuleManager.UnityLogHandle.InterceptLogHandler.LogFormat] Module ModuleHierarchyReconstructor threw during OnLoad: System.InvalidOperationException: Sequence contains no matching element
  at System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x00011] in <fbb5ed17eb6e46c680000f8910ebb50c>:0 
  at KSPSecondaryMotion.ModuleHierarchyReconstructor.OnLoad (ConfigNode node) [0x001a4] in <416294fdcd3140efbb7e2db6f1e8e0b9>:0 
  at PartModule.Load (ConfigNode node) [0x001ab] in <c1858a3f77504bd1aaa946fdccf84670>:0 

 

full log: https://drive.google.com/file/d/1hTTXxsH6mRiKItAE7v1c3F3JcFFBBVJu/view?usp=sharing

Thank you for reporting these issues.

Issues about theme names have been fixed in Version 0.1.1.

Unfortunately, I was unable to recreate the second error showed in your log on my machine. It might cause by an unknow incompatibility with another mod who also changed the hierarchy of that exact part (Communotron 16). 

It would be great if you can find out which mod caused this incompatibility since currently don't have much time in developing this mod due to personal reason. 

A complete list of mod installed would also help.

To temporally prevent this error from appearing: 
In KSPSecondaryMotion\Patches\StockAddon.cfg, disable or delete all the line after line 43 (that is, "@PART[longAntenna]:NEEDS[!ReStock] //Communotron 16" in currently version)
This will also disable the secondary motion effect on the stock Communotron 16 antenna.

Your KSPSecondaryMotion\Patches\StockAddon.cfg should look like this after disabling the config: 

Spoiler

@PART[largeSolarPanel]:NEEDS[!ReStock] //Gigantor XL Solar Array
{
	MODULE
	{
		name = ModuleHierarchyReconstructor
		RECONSTRUCT
		{
			name = KSPSM_Target
			reparent = False
			asChildOf = model
			asParentOf = _
			whichIsAChildOf = __ISROOTTRANSFORM__
			localPosition = -6.39, 0, 0
			localRotationEuler = 0, 0, 90
			localScale = 1, 1, 1
		}
		RECONSTRUCT
		{
			name = KSPSM_Rotate
			reparent = True
			asChildOf = _
			asParentOf = sunPivot
			whichIsAChildOf = model
			localPosition = -0.16, 0, 0
			localRotationEuler = 0, -90, 90
			localScale = 1, 1, 1
		}
	}

	MODULE
	{
		name = ModuleSpringPhysics
		targetName = KSPSM_Target				//Name of root ideal look at position
		rootName = KSPSM_Rotate					//Name of the root of rotation
		tipMass = 0.5							//Mass on the tip
		applyGravity = True						//Does gravity affect the motion of the tip?
		damperRatio = 4							//Damper ratio
		springRatio = 200						//Spring ratio
		failsafeRange = 2
	}
}

// @PART[longAntenna]:NEEDS[!ReStock] //Communotron 16
// {
	// MODULE
	// {
		// name = ModuleHierarchyReconstructor
		// RECONSTRUCT
		// {
			// name = KSPSM_Target
			// reparent = False
			// asChildOf = model
			// asParentOf = _
			// whichIsAChildOf = __ISROOTTRANSFORM__
			// localPosition = 0, 1.146, 0
			// localRotationEuler = 0, 0, 90
			// localScale = 1, 1, 1
		// }
		// RECONSTRUCT
		// {
			// name = KSPSM_Rotate
			// reparent = True
			// asChildOf = _
			// asParentOf = antenna
			// whichIsAChildOf = model
			// localPosition = 0, 0.0089, 0
			// localRotationEuler = -90, 0, 0
			// localScale = 1, 1, 1
		// }
	// }

	// MODULE
	// {
		// name = ModuleSpringPhysics
		// targetName = KSPSM_Target				//Name of root ideal look at position
		// rootName = KSPSM_Rotate					//Name of the root of rotation
		// tipMass = 0.2							//Mass on the tip
		// applyGravity = True						//Does gravity affect the motion of the tip?
		// damperRatio = 1.0						//Damper ratio
		// springRatio = 300						//Spring ratio
		// failsafeRange = 5
	// }
// }

 

I would look more into this once I got more spare time. 

Link to comment
Share on other sites

On 8/20/2020 at 12:23 PM, m4ti140 said:

I wonder if this could be used to add aeroelasticity effects to wings (without having to separate them into tiny segments). Is the effect only visual, or does stuff like collider, nodes etc. move as well?

The Quadratic Bezier Interpolation Module in this mod (used on the Tube man) could be used on the one-piece wing to provide smooth aeroelasticity. However, the spring physics module is not indented to be used in this case, it could work, but I imaging it will look super strange. The effect is only visual, the mod implements the effect by moving the bones of a skinned mesh.

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