Jump to content

Landing Gear (-> Wheel) not rotating


Recommended Posts

Hello guys,

I have worked on a landing gear for a project. So far, the animation works good, but now I'm running into issues: The wheel itself isn't rotating at all, which could end bad when you try to land..you know? :P Here is a screenshot of my Unity editor:

ZBc74VC.png

The Steering works ingame, but as I said, the Wheel is not rotating at all. Here's my part.cfg (or at least the important parts):


MODULE
{
name = ModuleLandingGear
animationName = Front Landing Gear
BrakeTorque = 4
BrakeSpeed = 0.5
}

MODULE
{
name = ModuleSteering
controlAxisType = Forward
steeringAxis = 0, 0, 1
steeringTransformName = Wheel
steeringLocked = false
steeringCurve
{
key = 0 16
key = 10 9
key = 30 2
key = 100 1
}
}

MODULE
{
name = FXModuleConstrainPosition
matchRotation = true
matchPosition = true
CONSTRAINFX
{
targetName = Wheel
moversName = wheelCollider
}

}

I oriented myselves on the Stock smallgearbay landing gear, but it's not that big help. I also looked at this image flying around on the forums from the Stock Landing Gear, but I have to say, I compared it with the Landing Gear config file, and it didn't helped at all. There's simply no "Steering" gameobject visible in the hierarchy of the Stock Landing Gear from the image.

I think it has something to do with the FXModuleConstrainPosition, but I don't get how it works. And from the other existing threads I didn't get the information I want or I need. Creating landing gears is really the most undocumented thing you can have for modding.

But I hope someone can help me! :)

Link to comment
Share on other sites

the two objects both named "wheelCollider" is probably confusing the module.

you need a wheelCollider component, it's a specialized component just for wheels with suspension. It is used by ModuleLandingGear, which provides visible suspension, wheel spinning, and deploy/retract animation trigger. ModuleSteering provides input control on a game object in the wheel heirarchy. FXModuleConstrainPosition links the wheelCollider to the object that responds to input control. the visible wheel mesh should be a child of the steer object.

another mesh collider for the visible wheel is optional, but should not be named "wheelCollider". only one object in the wheel setup should be named "wheelCollider"

landing gears and wheels are both very convoluted to setup correctly, you might have to dig some more. here's a unity project with working part file, might help you in your process. from this thread: http://forum.kerbalspaceprogram.com/threads/72802 dedicated to landing gears.

http://www./download/psu9e2k70d6wwz0/skylonNoseGear.zip

Edited by nli2work
Link to comment
Share on other sites

Hm, your explanation and the stuff you linked made things a tiny bit clearer, but I'm still not really getting it. I've removed now the 2nd wheelCollider.

So, the things I need would be those:

MODULE

{

name = ModuleLandingGear

animationName = Front Landing Gear

wheelCollider = wheelCollider

wheelName = Wheel

wheelRotationAxis = -1,0,0

BrakeTorque = 20

BrakeSpeed = 0.5

}

The FXModuleLookAtConstraint I think I don't need for now, I just want the wheels to rotate. :)

In Unity, the gameobject "wheelCollider" is a child of the "Wheel" object. The Wheel object is the wheel mesh itselves, without any colliders on it, the wheelCollider object is only the wheelcollider for the Wheel.

I've made it like that, and it's still not rotating. Also, the gear sinks into the ground, as if there was no collider for the wheel at all.

I hope you will be patient with me, and can help me..:blush:

Link to comment
Share on other sites

FXModuleLookAtConstraint is for setting up the suspension linkage arms so they move when the suspension moves up and down, they are optional.

the hierarchy look something like this:

SteeringObject

wheelCollider

WheelMesh

AdditionalStuff-Optional

the wheel mesh object is on the same level as wheelCollider, not a child of wheelCollider. Alternatively you can place the wheelCollider on the same level as SteeringObject and use FXModuleConstraintPosition to link it to the SteeringObject.

and no spaces in any object names, replace spaces with underscore if necessary.

Edited by nli2work
Link to comment
Share on other sites

OK, I've made it now a bit else than before, but it's still not working. I edited the mesh collider for the stem of the wheel, it went a little bit inside the mesh collider, now it doesn't conflict with it anymore, but it's still not working. Also, it looks like the game doesn't even sees that there's a wheel collider. The gear sinks in the ground, until the mesh collider of the stem has contact with the ground.

So, must I enter the name of the Wheel Collider itself (The name would be just "Wheel Collider") or must I use the name of the gameobject the Wheel Collider is applied to (The name then would be "wheelCollider")?

I've also rearranged my hierarchy a bit:

Front Landing Gear (Parttools export component on it, animation component)

Fahrwerk_vorne (This is the thing which will retract when the animation is played)

Steering (This is a new empty gameobject which is the object where collider and wheel is applied to, for a proper steering)

Reifen_vorne (The mesh of the wheels which should be rotating later ingame)

wheelCollider (The object with the Wheel Collider for the Wheel)

Scheinwerfer (They have no function yet, they are just there for design purposes)

Fahrwerk_vorne_Stange_1 (The Strut you can see on the first picture going away from the gear stem, also animated)

Fahwerkklappe_vorne_seitlich_links (The thing which covers the gear when it is retracted, see image in post#1, animated)

Fahrwerkklappe_vorne_seitlich_rechts (The thing which covers the gear when it is retracted, see image in post#1, animated)

I don't get what I'm doing wrong ;.;

Link to comment
Share on other sites

the names can be anything strictly speaking, without spaces and special characters. As long as you give the Part Modules the correct objects they will work.

MODULE

{

name = ModuleLandingGear

animationName = Front Landing Gear
\\ Deploy/Retract animation, the clip in the Animation component

wheelCollider = wheelCollider
\\name of the object with the wheel collider component, the object can be any name you want. naming it "wheelCollider" just makes it easier to identify than
"8k3nf8"

wheelName = Wheel
\\name of the visible mesh object that spins, again, any name can do. but ideally something that's easily identifiable.

wheelRotationAxis = -1,0,0
\\axis around which the Wheel mesh spins in X,Y,Z. typically X. add/remove negative sign to reverse direction

BrakeTorque = 20

BrakeSpeed = 0.5

}

you are making progress. Still need to add suspension. :)

so to get the full landing gear module, you need one more object. Maybe the light as well, not sure on that one.

MODULE

{

...

suspensionParentName = suspensionParent

\\
follows the suspension settings in the unity component up/down based on weight being supported. check Unity docs for specifics of wheel collider, this images might help too

...

}

hierarchy would look something like this, check the sample file in the previous post.

StrutsAndDoorPanels

SteeringObject

wheelCollider

suspensionParent

WheelMesh

AdditionalStuff-Optional

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