Jump to content

[1.8.x] KSPWheel - Physics Based Alternate Wheel Collider [API Only]


Shadowmage

Recommended Posts

  • 4 weeks later...
55 minutes ago, USB4 said:

Are there any source examples of this? I have absolutely no idea what Im doing

There are examples of the configs being used in KerbalFoundries (see signature).

The actual source code is available through the Github link on the front page.

Link to comment
Share on other sites

  • 1 month later...

So Ive been messing around for longer than I care to admit trying to fix this issue and was wondering if anyone perhaps knew offhand what exactly Ive done wrong here.

 

If I set the spring settings the lowest possible in game it becomes more manageable, but outside of that it bounces, and bounces.

Edited by USB4
Link to comment
Share on other sites

5 minutes ago, 0111narwhalz said:

@USB4

This sounds like excessive damping. Generally speaking, the settings shouldn't be at either extreme. Additionally, you should be well below your load rating per wheel.

I almost feel silly for asking, but Ive been searching this thread, and the somewhat limited wiki and answers come slowly if it all so I might as well ask what are probably some silly questions and get it out of the way.

By load rating, you mean, loadRating =  in kspwheelbase not load = per wheel?

Also, and this is probably sillier, how would you go about setting dampening in the config file?

 

I actually have a lot more rather basic questions ive been stacking up but I dont want to bombard anyone with them.. 

Link to comment
Share on other sites

Just now, USB4 said:

So Ive been messing around for longer than I care to admit trying to fix this issue and was wondering if anyone perhaps knew offhand what exactly Ive done wrong here.

 

If I set the spring settings the lowest possible in game it becomes more manageable, but outside of that it bounces, and bounces.

I guess you could try lowering the spring? I really don't know much of these settings, but today I had the same problem and I fixed it moving those two setting quite low (not to the extreme either) Also make sure just in case your wheels are at the same altitude level, and are facing straight vertically...

TIP: if you have the wheels more or less lined up, you toggle snap to 15 or anything that isn't the "circular" option, and by just clicking the verical arrow in both wheels (or whatever you want to line up) and it will snap to the exact altitude. This is helpful if they are not lined up properly....

Edited by Agustin
Link to comment
Share on other sites

Figured out how to put damping/wheel settings in the config from searching through the repository. Still very much feels like Im going about it the wrong way though. Like Im missing something about balancing wheels, as the stock ones from KF seem to be perfect out of the gate, and dont need you to play with the settings. They also have no bouncing whatsoever and by default have the default spring rating/damp ratio settings.

Edited by USB4
Link to comment
Share on other sites

7 hours ago, 0111narwhalz said:

That's weird. There should be two sliders (for spring strength and damp ratio) in the editor and in flight. Do you have advanced tweakables on?

They are availible in game, and I can change them there. I wanted to fix this by default so like the kerbal foundries mods wheels, they dont bounce right out of the gate. They still bounce even with these settings at min or max though when there is low load on the wheel, so surely theres something else wrong.

 

Was thinking it might be something to do with my unity hierarchy but the suspension and wheels are seperate.

Spoiler

Vluqkre.png

 

Edited by USB4
Link to comment
Share on other sites

2 hours ago, USB4 said:

They are availible in game, and I can change them there. I wanted to fix this by default so like the kerbal foundries mods wheels, they dont bounce right out of the gate. They still bounce even with these settings at min or max though when there is low load on the wheel, so surely theres something else wrong.

 

Was thinking it might be something to do with my unity hierarchy but the suspension and wheels are seperate.

  Reveal hidden contents

Vluqkre.png

 

From looking at the .gif you posted -- your wheel colliders are raycasting and hitting another collider in their hierarchy improperly.  Any colliders in the wheel part itself need to be set to layer 26 (wheelColliderIgnore) 

Might also not have the load rating setup per-wheel -- https://github.com/shadowmage45/KerbalFoundries2/blob/master/GameData/KerbalFoundries/Parts/TracksMole.cfg#L109-L156  The 'load=' entry in the WHEEL blocks denotes how much of the entire 'maxLoad' that individual wheel can support as a decimal percent.  So generally you want it to be 1/wheelCount.

Could you show pictures of your hierarchy, including colliders, and possibly post the config?

 

Link to comment
Share on other sites

3 hours ago, Shadowmage said:

From looking at the .gif you posted -- your wheel colliders are raycasting and hitting another collider in their hierarchy improperly.  Any colliders in the wheel part itself need to be set to layer 26 (wheelColliderIgnore) 

Might also not have the load rating setup per-wheel -- https://github.com/shadowmage45/KerbalFoundries2/blob/master/GameData/KerbalFoundries/Parts/TracksMole.cfg#L109-L156  The 'load=' entry in the WHEEL blocks denotes how much of the entire 'maxLoad' that individual wheel can support as a decimal percent.  So generally you want it to be 1/wheelCount.

Could you show pictures of your hierarchy, including colliders, and possibly post the config?

 

Sounds like you've found it (though no other colliders are directly parents or children of the colliders). I have a wheel  backup collider (for when the wheel is upside down or otherwise not making contact wheel collider wise). Its a cylinder and its labeled WheelBCollider* compared to the wheel collider transforms for KSP wheel, labeled WheelCollider*.

 

There is also a box collider on the meshed object labeled WheelLowerBracket*

Image of Hierarchy with one of each copied tree fully opened:

Spoiler

3pAJm0y.png

Full Config (its pretty messy as Ive been looking through the repository messing with things as well as troubleshooting):

Spoiler

PART
{
	
name = SinglePieceLandingGearRugged
module = Part
author = USB4

MODEL
{
	model = UnknownResourcefulness/Parts/LandingGear/SinglePieceLandingGearRugged/SinglePieceLandingGearRugged
}
scale = 1
rescaleFactor = 1

node_stack_Top = 0.0, 0.0, 0.1, 0.0, 0.0, 1.0, 2
node_stack_Front = 0.0, 0.0, 0.625, 0.0, 1.0, 0.0, 2
node_stack_Back = 0.0, 0.0, 0.625, 0.0, -1.0, 0.0, 2
node_attach = 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 1

// attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision	
attachRules = 1,1,1,1,0


TechRequired = advancedMotors
entryCost = 6000
cost = 800
category = Ground
subcategory = 0
title = Box Of Wheels: Rugged Edition (SPLGR)
manufacturer = UnknownResourcefulness: Box Of Wheels
description = Ever wanted landing gear, all inside one box? Well wheel get you set right up! Slightly more sturdy than standard, this Box Of Wheels will make your head spin.
buoyancy = 0.2

mass = 0.25
dragModelType = default
maximum_drag = 0.3
minimum_drag = 0.2
angularDrag = 1
maxTemp = 2400 

crashTolerance = 50
breakingForce = 100
breakingTorque = 100

//Lights
MODULE
	{
		name = ModuleLight
		lightName = Spotlight
		useAnimationDim = True
		lightBrightenSpeed = 1
		lightDimSpeed = 2.5
		resourceAmount = 0.01
		animationName = Light
		useResources = True
		layer = 1
	}

//wheel master module; responsible for all of the wheel colliders
MODULE
{
	name = KSPWheelBase
	
	//this is wheelIndex = 0
	WHEEL
	{
		colliderName = WheelCollider0
		radius = 0.08
		mass = 0.03
		travel = 0.2
		load = 0.25
		symmetryIndex = 2
		wheelGroup = 2
	}
	//this is wheelIndex = 1
	WHEEL
	{
		colliderName = WheelCollider1
		radius = 0.08
		mass = 0.03
		travel = 0.2
		load = 0.25
		symmetryIndex = 1
		wheelGroup = 1
	}
	//this is wheelIndex = 2
	WHEEL
	{
		colliderName = WheelCollider2
		radius = 0.08
		mass = 0.03
		travel = 0.2
		load = 0.25
		symmetryIndex = 1
		wheelGroup = 1
	}
	//this is wheelIndex = 3
	WHEEL
	{
		colliderName = WheelCollider3
		radius = 0.08
		mass = 0.03
		travel = 0.2
		load = 0.25
		symmetryIndex = 2
		wheelGroup = 2
	}
	loadRating = 10
	useSelfAntiRoll = true //added from recommendation
	antiRoll = 1
	//springRating = 0.2
	minLoadRating = 1
	maxLoadRating = 15
	maxSpeed = 450
	boundsColliderName = Bounds
	groundHeightOffset = 0.5
	//suspensionTarget = 0.2
}

//animation module, responsible for the base deploy animation
MODULE
{
	name = KSPWheelDeployment
	animationName = Deploy
	//tempColliderName = WheelMeshFront
	//tempColliderOffset = 0
	//tempColliderAxis = 0,1,0
	retractEffect = retract
	retractedEffect = retracted
	deployEffect = deploy
	deployedEffect = deployed
	layer = 2
}

//Front Left //Left wheel suspension, steering, rotation, brakes
MODULE
{
	name = KSPWheelSuspension
	wheelIndex = 3
	suspensionName = SuspensionTargetFrontLeft3
	suspensionOffset = 0
	suspensionAxis = 0, 1, 0
	retractedPosition = 0
}
MODULE
{
	name = KSPWheelRotation
	wheelIndex = 3
	wheelMeshName = WheelAxle3
	rotationAxis = -1, 0, 0
	editorRotation = true
}
MODULE
{
	name = KSPWheelMotor
	wheelIndex = 3
	maxMotorTorque = 1
	maxRPM = 1300
	gearRatio = 1
	tankSteering = true
	showGUIStats = false
	showGUISteerLock = false
	showGUIHalfTrack = false
}
MODULE
{
	name = KSPWheelBrakes
	wheelIndex = 3
	maxBrakeTorque = 1 //100
}

//Front Right //right wheel suspension, steering, rotation, brakes
MODULE
{
	name = KSPWheelSuspension
	wheelIndex = 2
	suspensionName = SuspensionTargetFrontRight2
	suspensionOffset = 0
	suspensionAxis = 0, 1, 0
	retractedPosition = 0
}
MODULE
{
	name = KSPWheelRotation
	wheelIndex = 2
	wheelMeshName = WheelAxle2
	rotationAxis = -1, 0, 0
	editorRotation = true
}
MODULE
{
	name = KSPWheelMotor
	wheelIndex = 2
	maxMotorTorque = 1
	maxRPM = 1300
	gearRatio = 1
	tankSteering = true
	showGUIStats = false
	showGUISteerLock = false
	showGUIHalfTrack = false
	invertSteering = true
}
MODULE
{
	name = KSPWheelBrakes
	wheelIndex = 2
	maxBrakeTorque = 1 //100
}

//Rear Right //right wheel suspension, steering, rotation, brakes
MODULE
{
	name = KSPWheelSuspension
	wheelIndex = 1
	suspensionName = SuspensionTargetRearRight1
	suspensionOffset = 0
	suspensionAxis = 0, 1, 0
	retractedPosition = 0
}
MODULE
{
	name = KSPWheelRotation
	wheelIndex = 1
	wheelMeshName = WheelAxle1
	rotationAxis = -1, 0, 0
	editorRotation = true
}
MODULE
{
	name = KSPWheelMotor
	wheelIndex = 1
	maxMotorTorque = 1
	maxRPM = 1300
	gearRatio = 1
	tankSteering = true
	invertSteering = true
	showGUIStats = false
	showGUISteerLock = false
	showGUIHalfTrack = false
}
MODULE
{
	name = KSPWheelBrakes
	wheelIndex = 1
	maxBrakeTorque = 1 //100
}

//Rear Left //right wheel suspension, steering, rotation, brakes
MODULE
{
	name = KSPWheelSuspension
	wheelIndex = 0
	suspensionName = SuspensionTargetRearLeft0
	suspensionOffset = 0
	suspensionAxis = 0, 1, 0
	retractedPosition = 0
}
MODULE
{
	name = KSPWheelRotation
	wheelIndex = 0
	wheelMeshName = WheelAxle0
	rotationAxis = -1, 0, 0
	editorRotation = true
}
MODULE
{
	name = KSPWheelMotor
	wheelIndex = 0
	maxMotorTorque = 1
	maxRPM = 1300
	gearRatio = 1
	tankSteering = true
	showGUIStats = false
	showGUISteerLock = false
	showGUIHalfTrack = false
}
MODULE
{
	name = KSPWheelBrakes
	wheelIndex = 0
	maxBrakeTorque = 1 //100
}

//shared module(s)
MODULE
{
	name = KSPWheelDamage
}

MODULE
{
	name = KSPWheelWaterPropulsion	
}

MODULE
{
	name = KSPWheelDustEffects
}

//animation constraints -- these drive a lot of the deployment animation
// as well as the actual suspension movement
MODULE
{
	name = KSPWheelConstraints
	
	//Rear Left Arm Constraints//Right wheel constraints
	CONSTRAINT
	{
		mover = WheelUpperBracket0 //RearBracketRight
		target = SuspensionTargetRearLeft0 //SuspensionTargetRight
		type = LOOKLOCK
		mainAxis = 0, 1, 0
		secAxis = 1, 0, 0
	}
	CONSTRAINT
	{
		mover = WheelLowerBracket0
		target = SuspensionTargetRearLeft0
		type = POSITION
	}
	
	//Rear Right Arm Constraints//Right wheel constraints
	CONSTRAINT
	{
		mover = WheelUpperBracket1 //RearBracketRight
		target = SuspensionTargetRearRight1 //SuspensionTargetRight
		type = LOOKLOCK
		mainAxis = 0, 1, 0
		secAxis = 1, 0, 0
	}
	CONSTRAINT
	{
		mover = WheelLowerBracket1
		target = SuspensionTargetRearRight1
		type = POSITION
	}
	
	//Front Right Arm Constraints//Right wheel constraints
	CONSTRAINT
	{
		mover = WheelUpperBracket2 //RearBracketRight
		target = SuspensionTargetFrontRight2 //SuspensionTargetRight
		type = LOOKLOCK
		mainAxis = 0, -1, 0
		secAxis = 1, 0, 0
	}
	CONSTRAINT
	{
		mover = WheelLowerBracket2
		target = SuspensionTargetFrontRight2
		type = POSITION
	}
	
	//Front Left Arm Constraints//Right wheel constraints
	CONSTRAINT
	{
		mover = WheelUpperBracket3 //RearBracketRight
		target = SuspensionTargetFrontLeft3 //SuspensionTargetRight
		type = LOOKLOCK
		mainAxis = 0, -1, 0
		secAxis = 1, 0, 0
	}
	CONSTRAINT
	{
		mover = WheelLowerBracket3
		target = SuspensionTargetFrontLeft3
		type = POSITION
	}
}

//sounds
MODULE
{
	name = KSPWheelSounds
	wheelIndex = 3
	motorEffect = WheelEffect
	runningEffect = WheelEffect
	motorEffect = MotorEffect
	latSlipEffect = SlipEffect
}

MODULE
{
	name = KSPWheelSounds
	wheelIndex = 2
	motorEffect = WheelEffect
	runningEffect = WheelEffect
	motorEffect = MotorEffect
	latSlipEffect = SlipEffect
}

MODULE
{
	name = KSPWheelSounds
	wheelIndex = 1
	motorEffect = WheelEffect
	runningEffect = WheelEffect
	motorEffect = MotorEffect
	latSlipEffect = SlipEffect
}

MODULE
{
	name = KSPWheelSounds
	wheelIndex = 0
	motorEffect = WheelEffect
	runningEffect = WheelEffect
	motorEffect = MotorEffect
	latSlipEffect = SlipEffect
}

EFFECTS
{
	WheelEffect
	{
		AUDIO
		{
			channel = Ship
			clip = KerbalFoundries/Sounds/wheel2
			volume = 0.0 0.0
			volume = 0.1 0.2
			volume = 1.0 0.7
			pitch = 0.0 0.2
			pitch = 1.0 0.7
			loop = true
		}
	}
	MotorEffect
	{
		AUDIO
		{
			channel = Ship
			clip = KerbalFoundries/Sounds/wheel
			volume = 0.0 0.0
			volume = 0.1 0.2
			volume = 1.0 1.5
			pitch = 0.0 0.7
			pitch = 1.0 1.0
			loop = true
		}
	}
	SlipEffect
	{
		AUDIO
		{
			channel = Ship
			clip = KerbalFoundries/Sounds/slip
			volume = 0.0 0.0
			volume = 0.1 0.2
			volume = 0.6 1.0
			volume = 1.0 0.6
			pitch = 0.0 0.8
			pitch = 1.0 0.5
			loop = true
		}
	}
	deploy
	{
		AUDIO
		{
			channel = Ship
			clip = Squad/Sounds/elev_start
			volume = 0 0
			volume = 1 0.5
			pitch = 0.75
		}
		AUDIO_LOOP
		{
			channel = Ship
			clip = Squad/Sounds/elev_loop
			volume = 0 0
			volume = 1 0.5
			pitch = 0.75
		}
	}
	deployed
	{
		AUDIO
		{
			channel = Ship
			clip = Squad/Sounds/elev_stop
			volume = 0 0
			volume = 1 0.5
			pitch = 0.75
		}
	}
	retract
	{
		AUDIO
		{
			channel = Ship
			clip = Squad/Sounds/elev_start
			volume = 0 0
			volume = 1 0.5
			pitch = 0.75
		}
		AUDIO_LOOP
		{
			channel = Ship
			clip = Squad/Sounds/elev_loop
			volume = 0 0
			volume = 1 0.5
			pitch = 0.75
		}
	}
	retracted
	{
		AUDIO
		{
			channel = Ship
			clip = Squad/Sounds/elev_stop
			volume = 0 0
			volume = 1 0.5
			pitch = 1.0
		}
	}
}
}

 

If you feel its necessary I can upload a unity package of everything too.

 

 

As for how to fix this, if Im getting this right, youre talking about making a layer in Unity on layer 26 labeled wheelColliderIgnore for all objects with colliders near the wheel collider like this?

Spoiler

Ta6CGNF.png

EDIT: Put the offending colliders in the layer as described, and it seems to be working =)

 

Its smooth, though it still need some playing with collider size etc.

Edited by USB4
Link to comment
Share on other sites

2 hours ago, USB4 said:

As for how to fix this, if Im getting this right, youre talking about making a layer in Unity on layer 26 labeled wheelColliderIgnore for all objects with colliders near the wheel collider like this?

  Hide contents

Ta6CGNF.png

EDIT: Put the offending colliders in the layer as described, and it seems to be working =)

 

Its smooth, though it still need some playing with collider size etc.

That ignore layer is standard ksp stuff, not just for KSPWheel by the way. It tells the engine to ignore collision between those parts and the wheel collider (obviously), and became super important after 1.1.

Link to comment
Share on other sites

Quick question again, my suspension seems to basically always ride flat, fully compressed even with  0.8 spring rating. Not really sure why. Ive tried looking through the repository for values that might change where  the midpoint, or place of balance  is  but Im not sure what it depends on exactly. 

 

Edit: So I played around and changed load = to 1 and it seems to do what I was looking for, but from shadowmages description it sounds like Im doing it the wrong way. Hmm. 

 

I wonder if I just misunderstood. Seems like thats what happened after further testing, but then 1/wheel doesnt work right...

Edited by USB4
Link to comment
Share on other sites

On 12/25/2017 at 6:27 PM, USB4 said:

Quick question again, my suspension seems to basically always ride flat, fully compressed even with  0.8 spring rating. Not really sure why. Ive tried looking through the repository for values that might change where  the midpoint, or place of balance  is  but Im not sure what it depends on exactly. 

 

Edit: So I played around and changed load = to 1 and it seems to do what I was looking for, but from shadowmages description it sounds like Im doing it the wrong way. Hmm. 

 

I wonder if I just misunderstood. Seems like thats what happened after further testing, but then 1/wheel doesnt work right...

Post the config please?   (I can only do so much with just guessing at what you have setup / don't have setup)

Edit:  Your config from above looks to be correct:

MODULE
{
	name = KSPWheelBase
	
	//this is wheelIndex = 0
	WHEEL
	{
		colliderName = WheelCollider0
		radius = 0.08
		mass = 0.03
		travel = 0.2
		load = 0.25
		symmetryIndex = 2
		wheelGroup = 2
	}
	//this is wheelIndex = 1
	WHEEL
	{
		colliderName = WheelCollider1
		radius = 0.08
		mass = 0.03
		travel = 0.2
		load = 0.25
		symmetryIndex = 1
		wheelGroup = 1
	}
	//this is wheelIndex = 2
	WHEEL
	{
		colliderName = WheelCollider2
		radius = 0.08
		mass = 0.03
		travel = 0.2
		load = 0.25
		symmetryIndex = 1
		wheelGroup = 1
	}
	//this is wheelIndex = 3
	WHEEL
	{
		colliderName = WheelCollider3
		radius = 0.08
		mass = 0.03
		travel = 0.2
		load = 0.25
		symmetryIndex = 2
		wheelGroup = 2
	}
	loadRating = 10
	useSelfAntiRoll = true //added from recommendation
	antiRoll = 1
	//springRating = 0.2
	minLoadRating = 1
	maxLoadRating = 15
	maxSpeed = 450
	boundsColliderName = Bounds
	groundHeightOffset = 0.5
	//suspensionTarget = 0.2
}

 

If it is still running fully compressed -- try checking out the values in the debug menu (go to the difficulty settings -> KSPWheel -> click the checkbox to enable debug mode), and see what the actual wheel colliders think they are doing.  Notably you want to check the compression %, and the force-Y (spring force) values.

Edited by Shadowmage
Link to comment
Share on other sites

 

Quote

If it is still running fully compressed -- try checking out the values in the debug menu (go to the difficulty settings -> KSPWheel -> click the checkbox to enable debug mode), and see what the actual wheel colliders think they are doing.  Notably you want to check the compression %, and the force-Y (spring force) values.

I changed the values back to 0.25 to check and its fully compressed. 

Spoiler

rNdVBnp.png

Third wheel is the front right wheel. This craft weighed 6kg. I lightened it to 4 and the force y became smaller, and the compression stayed the same.

 

With the load settings all at 1, it stays at roughly 50% compression on flat and has iirc 16 fy.

 

Config:

//Sound From Squad and Kerbal Foundries

PART
{
	
name = SinglePieceLandingGearRugged
module = Part
author = USB4

MODEL
{
	model = UnknownResourcefulness/Parts/LandingGear/Assets/SinglePieceLandingGearRugged
}
scale = 1
rescaleFactor = 1

node_stack_Top = 0.0, 0.0, -0.1, 0.0, 0.0, -1.0, 1
node_stack_Front = 0.0, 0.0, -0.625, 0.0, 1.0, 0.0, 2
node_stack_Back = 0.0, 0.0, -0.625, 0.0, -1.0, 0.0, 2
node_attach = 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1

// attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision	
attachRules = 1,1,1,1,0


TechRequired = advancedMotors
entryCost = 6000
cost = 800
category = Ground
subcategory = 0
title = Box Of Wheels: Rugged Edition (SPLGR)
manufacturer = UnknownResourcefulness: Box Of Wheels
description = Ever wanted landing gear, all inside one box? Well wheel get you set right up! Slightly more sturdy than standard, this Box Of Wheels will make your head spin.
buoyancy = 0.2

mass = 0.25
dragModelType = default
maximum_drag = 0.2
minimum_drag = 0.2
angularDrag = 1
maxTemp = 2400 

crashTolerance = 50
breakingForce = 100
breakingTorque = 100

DRAG_CUBE
{
	cube = Retracted,2.231,0.61888,0.7222,2.231,0.61488,0.7222,0.4158,0.66752,1.795,0.4151,0.6488,0.684,2.196,0.64248,0.4011,2.196,0.68552,0.4218, 0,0,0.1029, 1.25,1.782,0.4598
	cube = Deployed, 2.231,0.7736,0.7222, 2.231,0.7686,0.7222, 0.4158,0.8344,1.795, 0.4151,0.811,0.684, 2.196,0.8031,0.4011, 2.196,0.8569,0.4218, 0,0,0.1029, 1.25,1.782,0.4598
}

//Lights
MODULE
	{
		name = ModuleLight
		lightName = Spotlight
		useAnimationDim = True
		lightBrightenSpeed = 1
		lightDimSpeed = 2.5
		resourceAmount = 0.01
		animationName = Light
		useResources = True
		layer = 1
	}

//wheel master module; responsible for all of the wheel colliders
MODULE
{
	name = KSPWheelBase
	
	//this is wheelIndex = 0
	WHEEL
	{
		colliderName = WheelCollider0
		radius = 0.0875
		mass = 0.02
		travel = 0.1
		load = 0.25 //1
		//symmetryIndex = 2
		wheelGroup = 2
	}
	//this is wheelIndex = 1
	WHEEL
	{
		colliderName = WheelCollider1
		radius = 0.0875
		mass = 0.02
		travel = 0.1
		load = 0.25 //1
		//symmetryIndex = 1
		wheelGroup = 1
	}
	//this is wheelIndex = 2
	WHEEL
	{
		colliderName = WheelCollider2
		radius = 0.0875
		mass = 0.02
		travel = 0.1
		load = 0.25 //1
		//symmetryIndex = 1
		wheelGroup = 1
	}
	//this is wheelIndex = 3
	WHEEL
	{
		colliderName = WheelCollider3
		radius = 0.0875
		mass = 0.02
		travel = 0.1
		load = 0.25 //1
		//symmetryIndex = 2
		wheelGroup = 2
	}
	loadRating = 8
	useSelfAntiRoll = true //added from recommendation
	antiRoll = 1
	//springRating = 0.2
	minLoadRating = 0.5
	maxLoadRating = 18
	maxSpeed = 1000
	//boundsColliderName = Bounds
	groundHeightOffset = 0.5
}

//animation module, responsible for the base deploy animation
MODULE
{
	name = KSPWheelDeployment
	animationName = Deploy
	//tempColliderName = WheelMeshFront
	//tempColliderOffset = 0
	//tempColliderAxis = 0,1,0
	retractEffect = retract
	retractedEffect = retracted
	deployEffect = deploy
	deployedEffect = deployed
	layer = 2
}

//Front Left //Left wheel suspension, steering, rotation, brakes
MODULE
{
	name = KSPWheelSuspension
	wheelIndex = 3
	suspensionName = SuspensionTargetFrontLeft3
	suspensionOffset = 0
	suspensionAxis = 0, 1, 0
	retractedPosition = 0
}
MODULE
{
	name = KSPWheelRotation
	wheelIndex = 3
	wheelMeshName = WheelAxle3
	rotationAxis = -1, 0, 0
	editorRotation = true
}
MODULE
{
	name = KSPWheelMotor
	wheelIndex = 3
	maxMotorTorque = 1
	maxRPM = 800
	gearRatio = 1
	tankSteering = true
	showGUIStats = false
	showGUISteerLock = false
	showGUIHalfTrack = false
}
MODULE
{
	name = KSPWheelBrakes
	wheelIndex = 3
	maxBrakeTorque = 1.5 //100
}

//Front Right //right wheel suspension, steering, rotation, brakes
MODULE
{
	name = KSPWheelSuspension
	wheelIndex = 2
	suspensionName = SuspensionTargetFrontRight2
	suspensionOffset = 0
	suspensionAxis = 0, 1, 0
	retractedPosition = 0
}
MODULE
{
	name = KSPWheelRotation
	wheelIndex = 2
	wheelMeshName = WheelAxle2
	rotationAxis = -1, 0, 0
	editorRotation = true
}
MODULE
{
	name = KSPWheelMotor
	wheelIndex = 2
	maxMotorTorque = 1
	maxRPM = 800
	gearRatio = 1
	tankSteering = true
	showGUIStats = false
	showGUISteerLock = false
	showGUIHalfTrack = false
	invertSteering = true
}
MODULE
{
	name = KSPWheelBrakes
	wheelIndex = 2
	maxBrakeTorque = 1.5 //100
}

//Rear Right //right wheel suspension, steering, rotation, brakes
MODULE
{
	name = KSPWheelSuspension
	wheelIndex = 1
	suspensionName = SuspensionTargetRearRight1
	suspensionOffset = 0
	suspensionAxis = 0, 1, 0
	retractedPosition = 0
}
MODULE
{
	name = KSPWheelRotation
	wheelIndex = 1
	wheelMeshName = WheelAxle1
	rotationAxis = -1, 0, 0
	editorRotation = true
}
MODULE
{
	name = KSPWheelMotor
	wheelIndex = 1
	maxMotorTorque = 1
	maxRPM = 800
	gearRatio = 1
	tankSteering = true
	invertSteering = true
	showGUIStats = false
	showGUISteerLock = false
	showGUIHalfTrack = false
}
MODULE
{
	name = KSPWheelBrakes
	wheelIndex = 1
	maxBrakeTorque = 1.5 //100
}

//Rear Left //right wheel suspension, steering, rotation, brakes
MODULE
{
	name = KSPWheelSuspension
	wheelIndex = 0
	suspensionName = SuspensionTargetRearLeft0
	suspensionOffset = 0
	suspensionAxis = 0, 1, 0
	retractedPosition = 0
}
MODULE
{
	name = KSPWheelRotation
	wheelIndex = 0
	wheelMeshName = WheelAxle0
	rotationAxis = -1, 0, 0
	editorRotation = true
}
MODULE
{
	name = KSPWheelMotor
	wheelIndex = 0
	maxMotorTorque = 1
	maxRPM = 800
	gearRatio = 1
	tankSteering = true
	showGUIStats = false
	showGUISteerLock = false
	showGUIHalfTrack = false
}
MODULE
{
	name = KSPWheelBrakes
	wheelIndex = 0
	maxBrakeTorque = 1.5 //100
}

//shared module(s)
MODULE
{
	name = KSPWheelDamage
}

MODULE
{
	name = KSPWheelDustEffects
}

//animation constraints -- these drive a lot of the deployment animation
// as well as the actual suspension movement
MODULE
{
	name = KSPWheelConstraints
	
	//Rear Left Arm Constraints//Right wheel constraints
	CONSTRAINT
	{
		mover = WheelUpperBracket0 //RearBracketRight
		target = SuspensionTargetRearLeft0 //SuspensionTargetRight
		type = LOOKLOCK
		mainAxis = 0, 1, 0
		secAxis = 1, 0, 0
	}
	CONSTRAINT
	{
		mover = WheelLowerBracket0
		target = SuspensionTargetRearLeft0
		type = POSITION
	}
	
	//Rear Right Arm Constraints//Right wheel constraints
	CONSTRAINT
	{
		mover = WheelUpperBracket1 //RearBracketRight
		target = SuspensionTargetRearRight1 //SuspensionTargetRight
		type = LOOKLOCK
		mainAxis = 0, 1, 0
		secAxis = 1, 0, 0
	}
	CONSTRAINT
	{
		mover = WheelLowerBracket1
		target = SuspensionTargetRearRight1
		type = POSITION
	}
	
	//Front Right Arm Constraints//Right wheel constraints
	CONSTRAINT
	{
		mover = WheelUpperBracket2 //RearBracketRight
		target = SuspensionTargetFrontRight2 //SuspensionTargetRight
		type = LOOKLOCK
		mainAxis = 0, -1, 0
		secAxis = 1, 0, 0
	}
	CONSTRAINT
	{
		mover = WheelLowerBracket2
		target = SuspensionTargetFrontRight2
		type = POSITION
	}
	
	//Front Left Arm Constraints//Right wheel constraints
	CONSTRAINT
	{
		mover = WheelUpperBracket3 //RearBracketRight
		target = SuspensionTargetFrontLeft3 //SuspensionTargetRight
		type = LOOKLOCK
		mainAxis = 0, -1, 0
		secAxis = 1, 0, 0
	}
	CONSTRAINT
	{
		mover = WheelLowerBracket3
		target = SuspensionTargetFrontLeft3
		type = POSITION
	}
}

//sounds
MODULE
{
	name = KSPWheelSounds
	wheelIndex = 3
	motorEffect = WheelEffect
	runningEffect = WheelEffect
	motorEffect = MotorEffect
	latSlipEffect = SlipEffect
}

MODULE
{
	name = KSPWheelSounds
	wheelIndex = 2
	motorEffect = WheelEffect
	runningEffect = WheelEffect
	motorEffect = MotorEffect
	latSlipEffect = SlipEffect
}

MODULE
{
	name = KSPWheelSounds
	wheelIndex = 1
	motorEffect = WheelEffect
	runningEffect = WheelEffect
	motorEffect = MotorEffect
	latSlipEffect = SlipEffect
}

MODULE
{
	name = KSPWheelSounds
	wheelIndex = 0
	motorEffect = WheelEffect
	runningEffect = WheelEffect
	motorEffect = MotorEffect
	latSlipEffect = SlipEffect
}

RESOURCE
	{
		name = ElectricCharge
		amount = 50
		maxAmount = 50
	}

EFFECTS
{
	WheelEffect
	{
		AUDIO
		{
			channel = Ship
			clip = UnknownResourcefulness/Sounds/wheel2
			volume = 0.0 0.2
			volume = 0.1 0.5
			volume = 1.0 0.7
			pitch = 0.0 0.2
			pitch = 1.0 0.7
			loop = true
		}
	}
	MotorEffect
	{
		AUDIO
		{
			channel = Ship
			clip = UnknownResourcefulness/Sounds/wheel
			volume = 0.0 0.5
			volume = 0.1 0.8
			volume = 1.0 1.5
			pitch = 0.0 0.7
			pitch = 1.0 1.0
			loop = true
		}
	}
	SlipEffect
	{
		AUDIO
		{
			channel = Ship
			clip = UnknownResourcefulness/Sounds/slip
			volume = 0.0 0.0
			volume = 0.1 0.2
			volume = 0.6 1.0
			volume = 1.0 0.6
			pitch = 0.0 0.8
			pitch = 1.0 0.5
			loop = true
		}
	}
	deploy
	{
		AUDIO
		{
			channel = Ship
			clip = Squad/Sounds/elev_start
			volume = 0 0
			volume = 1 0.5
			pitch = 0.75
		}
		AUDIO_LOOP
		{
			channel = Ship
			clip = Squad/Sounds/elev_loop
			volume = 0 0
			volume = 1 0.5
			pitch = 0.75
		}
	}
	deployed
	{
		AUDIO
		{
			channel = Ship
			clip = Squad/Sounds/elev_stop
			volume = 0 0
			volume = 1 0.5
			pitch = 0.75
		}
	}
	retract
	{
		AUDIO
		{
			channel = Ship
			clip = Squad/Sounds/elev_start
			volume = 0 0
			volume = 1 0.5
			pitch = 0.75
		}
		AUDIO_LOOP
		{
			channel = Ship
			clip = Squad/Sounds/elev_loop
			volume = 0 0
			volume = 1 0.5
			pitch = 0.75
		}
	}
	retracted
	{
		AUDIO
		{
			channel = Ship
			clip = Squad/Sounds/elev_stop
			volume = 0 0
			volume = 1 0.5
			pitch = 1.0
		}
	}
}
}

Its all fine for me If I just set them all to 1 so its no problem  for me.

Edited by USB4
Link to comment
Share on other sites

7 minutes ago, USB4 said:

Its all fine for me If I just set them all to 1 so its no problem  for me.

If that is what works for you, then go with it.  Technically that should result in highly overpowered suspension, but likely there is something else 'wrong' in the config and/or model setup that this is correcting for.  Basically that setting (load=1) is saying that each wheel should be supporting 100% of the entire vehicles mass (at 50% compression -- that is the 'target point' for all wheels).

One other potential 'problem' with your part -- your suspension range / travel is extremely small.  You really want at minimum 0.25m worth of suspension travel.  Anything less than that can result in simulation instabilities.  Yes, obviously it can work with short suspension throws, but it is -going- to cause jitter and/or bouncing under some situations  (it is a limitation of the fixed-period physics integration that I have access to in Unity; it creates a very real limitation on how accurate the simulation can be).

Edited by Shadowmage
Link to comment
Share on other sites

24 minutes ago, Shadowmage said:

If that is what works for you, then go with it.  Technically that should result in highly overpowered suspension, but likely there is something else 'wrong' in the config that this is correcting for.

One other potential 'problem' with your part -- your suspension range / travel is extremely small.  You really want at minimum 0.25m worth of suspension travel.  Anything less than that can result in simulation instabilities.  Yes, obviously it can work with short suspension throws, but it is -going- to cause jitter and/or bouncing under some situations  (it is a limitation of the fixed-period physics integration that I have access to in Unity; it creates a very real limitation on how accurate the simulation can be).

Ah, I was wondering why the smaller set of wheels (2 wheels on a swivel) I was making were so bumpy compared to this one. Was playing with wheel size wondering if it was the culprit. Makes sense, but I suppose it works well enough for slow speeds on flat terrain. The 4 wheel one seems pretty decent however. I havent noticed any big issue even with just 0.1.

 

Something different: I sent you a response to a previous pm I dont think you noticed so I figured I might as well ask now: Is there a way to combine motors/wheels? Like lets say that I have a wheel that looks like this

Spoiler

jgRtIlb.png

where both wheels were affixed to one axel. In this case, id want them both to show up as/be controlled together. This would be helpful both for the wheel spinning animation but also for simplifying the menu. 

 

For reference the way I currently have it set up has 3 wheel colliders with one very loosely contacting the ground in the middle which controls mesh rotation and wheel steering, and the ones on the outside having motors.

Spoiler

7nJHXt6.png

I tried wheel width, but I dont think thats for this as it wasnt balanced at all.

Edited by USB4
Link to comment
Share on other sites

3 minutes ago, USB4 said:

Is there a way to combine motors/wheels?

No.  Generally for the setup you posted, I would have just a single wheel collider that sat in the middle of the two visual wheel meshes.  One collider = only one motor/steering/etc needed.

(it would technically be possible to adapt the code, but would also be massively complex and only cause more problems when things aren't setup properly; e.g. if the 'linked' wheels needed to spin in different directions because their transforms weren't setup properly)

However, one thing I might be able to setup, would be a method to 'link' the multiple modules together, and drive them all from a single GUI.  It would still fail if you needed the motors/steering on them inverted differently, so it would require even more careful model setup and transform orientations.  Would also be at least a few months before I'll have time to look at it (far too many other projects already in the works that I need to finish up).  Feel free to open an issue ticket on the KSPWheels repository for the feature request -- will make sure it doesn't get forgotten about in the interim.

 

One potential alternative might be to set the part up to use the 'KSPWheelTracks' module.  It is mostly what you are looking for -- a single 'motor' module that manipulates all of the wheel colliders on the part.  However, as stated above, all of the transforms must be setup appropriately to begin with, and it applies to all of the wheel colliders specified in the base module -- you can't pick and choose which ones it effects.  It is also only the motor (and brakes) that it can replace; there is no equivalent for steering.


One other thing that you might be interested in, is that you can force-hide any/all of the GUI controls for each module.  E.G. the motor module has the following fields to enable/disable the GUI for each feature (similar fields exist for steering, brakes, etc; note that the 'steering' controls posted below apply to tank-steering only, and not steering from the normal steering module--those controls exist in the normal steering module if needed):

        [KSPField]
        public bool showGUIMotorLimit = true;
        [KSPField]
        public bool showGUIMotorInvert = true;
        [KSPField]
        public bool showGUIMotorLock = true;
        [KSPField]
        public bool showGUISteerLock = true;
        [KSPField]
        public bool showGUISteerInvert = true;
        [KSPField]
        public bool showGUIGearRatio = true;
        [KSPField]
        public bool showGUIHalfTrack = true;
        [KSPField]
        public bool showGUIStats = true;

Combined with setting up the defaults appropriately for the motor/steering modules, it can result in a much cleaner part-right-click-menu (as long as the user doesn't need to actually adjust those settings, as if they are disable in the config, there is no in-game way to re-enable them).

 

17 minutes ago, USB4 said:

I tried wheel width,

Yeah, the wheel-width feature never got fully developed.  It was supposed to simulate wheels/etc as more than just a simple raycast, but I ran into problems while trying to keep it optimized (was certainly doable, but used so many raycasts/sweep operations that it slowed things down more than I would like).  Hopefully in the future I'll get all of that worked out and working, as it was building up to some rather interesting features and a much more robust vehicle simulation in general.

20 minutes ago, USB4 said:

For reference the way I currently have it set up has 3 wheel colliders with one very loosely contacting the ground in the middle

Again, for that use, I would use just a single wheel collider in the center, that was equipped with steering/motor/brakes.  Have the single steering module rotate the mesh(es) of all of the visible wheels (either use a single parent transform, or use same-named transforms, or constraints, to drive the outside wheels rotations).  The user really won't notice any difference in 99% of use (only on 'edge' cases where only some of the wheels would contact stuff).

You might be surprised how much you can approximate the wheels and still have them 'appear' fully functional in-game.  Quite surprised.

Link to comment
Share on other sites

35 minutes ago, Shadowmage said:

However, one thing I might be able to setup, would be a method to 'link' the multiple modules together, and drive them all from a single GUI.  It would still fail if you needed the motors/steering on them inverted differently, so it would require even more careful model setup and transform orientations.  Would also be at least a few months before I'll have time to look at it (far too many other projects already in the works that I need to finish up).  Feel free to open an issue ticket on the KSPWheels repository for the feature request -- will make sure it doesn't get forgotten about in the interim.

Seems neat. WIll do.

Quote

 

One potential alternative might be to set the part up to use the 'KSPWheelTracks' module.  It is mostly what you are looking for -- a single 'motor' module that manipulates all of the wheel colliders on the part.  However, as stated above, all of the transforms must be setup appropriately to begin with, and it applies to all of the wheel colliders specified in the base module -- you can't pick and choose which ones it effects.  It is also only the motor (and brakes) that it can replace; there is no equivalent for steering.

Il look into this.

Quote


One other thing that you might be interested in, is that you can force-hide any/all of the GUI controls for each module.  E.G. the motor module has the following fields to enable/disable the GUI for each feature (similar fields exist for steering, brakes, etc; note that the 'steering' controls posted below apply to tank-steering only, and not steering from the normal steering module--those controls exist in the normal steering module if needed):

I dug around a found these in the repository putting them in use in the 4 wheel retractable one. They work, but then customizability is lost out on I suppose. 

Quote

 

Yeah, the wheel-width feature never got fully developed.  It was supposed to simulate wheels/etc as more than just a simple raycast, but I ran into problems while trying to keep it optimized (was certainly doable, but used so many raycasts/sweep operations that it slowed things down more than I would like).  Hopefully in the future I'll get all of that worked out and working, as it was building up to some rather interesting features and a much more robust vehicle simulation in general.

This is already basically magic to me so that fair enough.

Quote

You might be surprised how much you can approximate the wheels and still have them 'appear' fully functional in-game.  Quite surprised.

I actually opened a ton of the default examples while trying to get a grip on how this works, and I have seen the sausage factory. Its all a lie! You sell me 4 wheels but I get 1!!!

Quote

Again, for that use, I would use just a single wheel collider in the center, that was equipped with steering/motor/brakes. 

 

Really though, the reason I went with this weird 3 wheel design, is because I wanted to be able to balance a crafton just 2 of these, and you cant really balance a 3d objects on 2 points, I think.

Quote

Have the single steering module rotate the mesh(es) of all of the visible wheels (either use a single parent transform, or use same-named transforms, or constraints, to drive the outside wheels rotations).  The user really won't notice any difference in 99% of use (only on 'edge' cases where only some of the wheels would contact stuff).

I actually solved the steering issue just by having the module meant for rotating the visual mesh rotate both the mesh and the wheel colliders of the wheels on the outside using this config and unity hierarchy:

Spoiler

1sc2NTo.png


//Sound From Kerbal Foundries

PART
{
	
name = OneSetLandingGear
module = Part
author = USB4

MODEL
{
	model = UnknownResourcefulness/Parts/LandingGear/Assets/OneSetLandingGear
}
scale = 1
rescaleFactor = 1

node_stack_Top = 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0
node_attach = 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0

// attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision	
attachRules = 1,1,1,1,0


TechRequired = aviation
entryCost = 1500
cost = 350
category = Ground
subcategory = 0
title = Box Of Wheels: Single Piece  (OSLG)
manufacturer = UnknownResourcefulness: Box Of Wheels
description = A small Basic Landing gear peice. It moves, it turns, it stops.

mass = 0.045
dragModelType = default
maximum_drag = 0.3
minimum_drag = 0.2
angularDrag = 1
maxTemp = 2400 

crashTolerance = 50
breakingForce = 100
breakingTorque = 100

MODULE
{
	name = KSPWheelBase
	WHEEL//wheelIndex = 0
	{
		colliderName = WheelColliderMiddle
		radius = 0.0875
		mass = 0.02
		travel = 0.1
		load = 0.5
	}
	WHEEL//wheelIndex = 1
	{
		colliderName = WheelColliderLeft
		radius = 0.0875
		mass = 0.02
		travel = 0.05
		load = 1
	}
	WHEEL//wheelIndex = 2
	{
		colliderName = WheelColliderRight
		radius = 0.0875
		mass = 0.02
		travel = 0.05
		load = 1
	}
	
	loadRating = 2
	minLoadRating = 0.1
	maxLoadRating = 5
	maxSpeed = 1000
	groundHeightOffset = 0.25
	useSelfAntiRoll = true //added from recommendation
	antiRoll = 1
}

MODULE
{
	name = KSPWheelRotation
	wheelMeshName = WheelAxle0
	rotationAxis = 1, 0, 0
	wheelIndex = 0
}

MODULE
{
	name = KSPWheelSuspension
	suspensionName = suspensionPoint
	suspensionOffset = 0
	suspensionAxis = 0, 1, 0
	wheelIndex = 0
}

MODULE
{
	name = KSPWheelSuspension
	suspensionName = suspensionPoint
	suspensionOffset = 0
	suspensionAxis = 0, 1, 0
	wheelIndex = 1
}

MODULE
{
	name = KSPWheelSuspension
	suspensionName = suspensionPoint
	suspensionOffset = 0
	suspensionAxis = 0, 1, 0
	wheelIndex = 2
}

MODULE
{
	name = KSPWheelSteering
	steeringName = SteeringTransform
	maxSteeringAngle = 20
	steeringAxis = 0, 1, 0
	useSteeringCurve = true
	steeringCurve
	{
		key = 0 1
		key = 5 0.1
		key = 7.5 0.02
		key = 10 0.01
		key = 20 0.01
		key = 40 0.01
		key = 60 0.01
	}
	steeringResponse = 0.1
}

MODULE
{
	name = KSPWheelMotor
	maxMotorTorque = 0.5
	maxRPM = 900
	gearRatio = 1
	wheelIndex = 1
	invertMirror = false
}

MODULE
{
	name = KSPWheelMotor
	maxMotorTorque = 0.5
	maxRPM = 900
	gearRatio = 1
	wheelIndex = 2
	invertMirror = false
}

MODULE
{
	name = KSPWheelBrakes
	maxBrakeTorque = 0.05
	wheelIndex = 0
}

MODULE
{
	name = KSPWheelBrakes
	maxBrakeTorque = 0.5
	wheelIndex = 1
}

MODULE
{
	name = KSPWheelBrakes
	maxBrakeTorque = 0.5
	wheelIndex = 2
}


MODULE
{
	name = KSPWheelDamage
}

MODULE
{
	name = KSPWheelWaterPropulsion	
}

MODULE
{
	name = KSPWheelDustEffects
}

//animation constraints -- these drive a lot of the deployment animation
// as well as the actual suspension movement
MODULE
{
	name = KSPWheelConstraints
	
	CONSTRAINT //Constraint for turning
	{
		mover = WheelLowerBracket0
		target = SteeringTransform
		type = ROTATION
	}
	
	CONSTRAINT //Constraint for turning
	{
		mover = WCT
		target = SteeringTransform
		type = ROTATION
	}
}

EFFECTS
{
	WheelEffect
	{
		AUDIO
		{
			channel = Ship
			clip = UnknownResourcefulness/Sounds/wheel2
			volume = 0.0 0.2
			volume = 0.1 0.5
			volume = 1.0 0.7
			pitch = 0.0 0.2
			pitch = 1.0 0.7
			loop = true
		}
	}
	MotorEffect
	{
		AUDIO
		{
			channel = Ship
			clip = UnknownResourcefulness/Sounds/wheel
			volume = 0.0 0.5
			volume = 0.1 0.8
			volume = 1.0 1.5
			pitch = 0.0 0.7
			pitch = 1.0 1.0
			loop = true
		}
	}
	SlipEffect
	{
		AUDIO
		{
			channel = Ship
			clip = UnknownResourcefulness/Sounds/slip
			volume = 0.0 0.0
			volume = 0.1 0.2
			volume = 0.6 1.0
			volume = 1.0 0.6
			pitch = 0.0 0.8
			pitch = 1.0 0.5
			loop = true
		}
	}
}



MODULE
{
	name = KSPWheelSounds
	wheelIndex = 1
	motorEffect = WheelEffect
	runningEffect = WheelEffect
	motorEffect = MotorEffect
	latSlipEffect = SlipEffect
}

MODULE
{
	name = KSPWheelSounds
	wheelIndex = 2
	motorEffect = WheelEffect
	runningEffect = WheelEffect
	motorEffect = MotorEffect
	latSlipEffect = SlipEffect
}

}

 

Theres almost certainly something wrong with the way ive implemented it that I havent figured out, but it if its stupid but it works, I can pretend its smart.

Edited by USB4
Link to comment
Share on other sites

40 minutes ago, USB4 said:

I actually opened a ton of the default examples while trying to get a grip on how this works, and I have seen the sausage factory. Its all a lie! You sell me 4 wheels but I get 1!!!

Hehe, yep.  The only place that I found multiple wheels to be 'necessary' was on the tracks -- and mostly only because it is logical that a vehicle can be supported by only two tracks.

40 minutes ago, USB4 said:

Really though, the reason I went with this weird 3 wheel design, is because I wanted to be able to balance a crafton just 2 of these, and you cant really balance a 3d objects on 2 points, I think.

Yep, if that is your intention with those parts -- you will need to set them up using multiple wheel colliders.

One thing you might try -- keep the two motor and steering modules, but have only one of the steering modules linked to the visible mesh.  The wheel colliders would be entirely outside of the steering hierarchy, so when the user 'turned' it would only turn the visible mesh -- both wheels would use their internal 'wheel-steering-angle', but visually I think it would accomplish what you are looking for.

I believe there is also support in the 'suspension' module so that it can read from multiple wheels to drive its compression (it averages their compressions, or something like that).  Take a peek at the KF skid part for examples, I think that is the only part currently using that feature (although, I believe it also uses some constraints as part of the setup).  Hmm.. actually, I've got no idea how I accomplished that setup.  Will see if I can figure it out and get back to you on it --- seems like it might be using mostly constraints in some odd fashion.

Edit: Found it -- it actually is built into the suspension module (with some constraint magic for the specific use in the skids, but you shouldn't need constraints for your simple two-wheel setup)

You can have a single 'KSPWheelSuspension' module read from multiple wheel-colliders (averaging the compression), by using the following setup:

MODULE
{
	name = KSPWheelSuspension
	//primary wheel index
	wheelIndex = 0
	//CSV list of additional wheels to use for suspension-compression averaging
	secondaryWheels = 1
	//standard suspension mesh name
	suspensionName = KF-Skid-SuspensionDummyCenter
}

-- It is still not going to be 100% precise, but not really any other way to do it with the current plugin code.

 

You seem to be making very good progress on figuring out the overall wheel rigging and config structure though.  Good job :)  Likely one of the most complex bits of KSP config setup (and model setup) that one can get into, especially when rigging the multi-wheel parts like that.  (part of the complexity is unfortunately due to KSPWheel -- multi-wheels were only intended to be supported in Tracks, so the feature-set is specific to that use; but at least it is possible with KSPWheel.... it is absolutely impossible to do it with the stock wheel system)

Edited by Shadowmage
Link to comment
Share on other sites

1 hour ago, Shadowmage said:

One thing you might try -- keep the two motor and steering modules, but have only one of the steering modules linked to the visible mesh.  The wheel colliders would be entirely outside of the steering hierarchy, so when the user 'turned' it would only turn the visible mesh -- both wheels would use their internal 'wheel-steering-angle', but visually I think it would accomplish what you are looking for.

The way I have it now seems to work without even needing other steering modules. The colliders are just constrained to follow the gameobject that controls the mesh.  This way i dont need anything else and one module controls all the wheels. 

 

1 hour ago, Shadowmage said:

Found it -- it actually is built into the suspension module (with some constraint magic for the specific use in the skids, but you shouldn't need constraints for your simple two-wheel setup)

Ill add either this and the track setup to see which works best.

1 hour ago, Shadowmage said:

You seem to be making very good progress on figuring out the overall wheel rigging and config structure though.

Yup. I mean maybe. You dont want to know how much time its taken to fiddle with things.

Link to comment
Share on other sites

1 minute ago, USB4 said:

The way I have it now seems to work without even needing other steering modules. The colliders are just constrained to follow the gameobject that controls the mesh.  This way i dont need anything else and one module controls all the wheels. 

Doing it that way is going to cause problems though -- because in that particular setup, not only is the wheel collider from the suspension module doing its internal steering, but the colliders themselves are also being rotated by the visible pivot -- so one of your wheels will have steering that lines up visually, the other one will have its internal steering value rotated more than you would expect.  You should be able to see this if you enable the debug-rendering (watch the blue lines -- they should stay parallel if it is setup properly).

But -- if it works for you, and seems stable -- probably 'good enough for video game use'. :)

 

Link to comment
Share on other sites

5 minutes ago, Shadowmage said:

Doing it that way is going to cause problems though -- because in that particular setup, not only is the wheel collider from the suspension module doing its internal steering, but the colliders themselves are also being rotated by the visible pivot -- so one of your wheels will have steering that lines up visually, the other one will have its internal steering value rotated more than you would expect.  You should be able to see this if you enable the debug-rendering (watch the blue lines -- they should stay parallel if it is setup properly).

But -- if it works for you, and seems stable -- probably 'good enough for video game use'. :)

 

I think I know what youre talking about, because I think I ran into it, and my solution was to put the middle wheel collider by itself in the middle and only have the turning constraint affect the 2 other wheels. so the 2 wheels on the outside move on a pivoted game object where the center wheel is if that makes sense. What Im saying is if I get what youre saying, I think I got rid of the double turning.

 

The debug shows all of the wheels pointed correctly while turning at least. I was going to load up to take another screen, but its basically this but pivoted around the middle. They all stay parallel and square.

 7nJHXt6.png

Edited by USB4
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...