Jump to content

[Plugin] 747-Style Landing Gear (Advanced Animatronic Landing Gear plugin)


OrbitusII

Recommended Posts

I've cheated a little bit, I use two wheelcolliders. One is placed directly at the end of the suspension strut and this governs the movement of the strut via a gameobject called (by convention) SuspensionTraverse.

There is a second wheelcollider that's placed behind the first, with double the suspension travel and above by half that travel. This has a SuspensionTraverse2 object that's moved by the code as usual, except this one moves no mesh directly. It moves the swingarm via a lookat to SuspensionTraverse2.

The first collider governs the rotation of the front wheels mesh, the second the rear. The rear collider has much lighter springing than the primary, as the weight should be carried by the central collider, which is simulating all the wheels being on the ground, and thus compressing the suspension proper.

http://i.imgur.com/omXEJuW.png

I figured if we both attack it from different angles the least we gain is a better understanding. Code is in my dev repo (did I give you access already?), though being updated fast with wheel rotation, steering, animation etc. and I'll pass back rigged models when I've finished messing about. I've learned a lot doing this, I have piles of notes to put in my advanced rigging tutorial, as well as some stuff I can use to improve my existing modules :D

I removed most of the superfluous mesh for clarity, will bung back in when I'm done testing.

Edit: to answer your question about what's different with the colliders: Nothing, except I have no transforms below them. Testing with your module revealed a few things:

The colliders calculate rotation, even if it's not them holding the model off the ground (or they're not actually enabled). The clues are: Brakes. Call the braketorque to the log and you'll see the brakes are not being applied even when the model seems glued to the runway.

Rotating the wheelcolliders away from the floor leaves the part firmly planted on the floor (though now appearing to float). This is a dead give-away, which lead me to messing with transform placement in the model. I can get the colliders to do their job correctly so long as there are no transforms below their level in the part and they are enabled. I came to the firm conclusion that it's not a collider issue, but a topology issue I'm afraid. At very least, the tranform position of the master parts needs fixing (this is easy), but your CONTACT object also causes the issue and this seemed instrumental to your simulation working as it stands.

I'm puzzled why you've got a separate raycast when you can use the racast from the collider, though? This might be a potential solution as (I think) you could do away with your CONTACT object and all will be good in the world. I could well be missing something fundamental, though :)

now I understand how you did this. Ingenious!

Link to comment
Share on other sites

I should remember not to get my hopes up too much

Anyway here is the main gear. It's only one side. If you want both you'll need to duplicate and mirror it. Remember it's not symmetrical like stock gear. All the objects that need to "look at" are oriented towards Z+ (I think that's how it should be)

Thank you. It gives me something meaningful to work with while I'm developing my plugin, so really helpful. I normally model stuff that has a lookAt in the correct starting position as the LookAt script doesn't work its magic until flight, so it's all left looking disconnected in the editor otherwise. Perfectly fine how it is for the moment, though.

now I understand how you did this. Ingenious!

Cheers. I like simple solutions :cool:

Link to comment
Share on other sites

I might take a look at fixing stuff up later today, I've got something else in the works right now that I'd like to finish but I can probably see to trying your suggestions, lo-fi.

Cool! As ever, shout if I can help at all. I'll keep an eye on the thread.

I've been getting a little side-tracked myself (though into something sort of related). I've created a stand-alone plugin that detects which side of the vessel a part is placed and activates a left or right handed mesh appropriately. I'm fed up with seeing people struggle with what they think is 'mirror' symmetry, when, in actual fact, it's rotational symmetry. Will be very easy to use - all you need to do is bundle both the left and right handed meshes into one part, each within a named GameObject (left and right seem most appropriate, though I'l leave it to the modeller to choose) and the plugin will work its magic activating one side or the other as appropriate. 'Symmetry' clones automatically get the opposite mesh activated, so asymmetric parts are now possible without actually having two separate parts (that then aren't placeable with symmetry mode). I believe I mentioned I had this idea while I was chatting in the last livestream. This should be particularly helpful with landing gear :)

A dedicated Dev thread will appear shortly and code will be completely permissively licensed.

Link to comment
Share on other sites

I have to say that I am incredibly tempted to simply throw out all of the code. lo-fi, could I get a Unity package with the wheel hierarchy you showed in your video on page 7? I have no idea what is wrong with my setup and code so I'll just take a look at your stuff to try and figure something out.

Link to comment
Share on other sites

No drama! There is one snag: I have to rig it again because Unity crashed out before I saved. I have the .mu, but that's really not much help! I've got the actual main gear model now though, so I'll get it fully rigged and bundled up for you to poke around with.

My method is at least simple, so long as you follow a few rules when putting the hierarchy together. The plugin is far from finished, but contains the bits you're interested in (though the heavy lifting is all done in .cfg calls) and you can probably teach me a thing or two about the animation stuff!

Actually, do you use GitHub? I've found it makes life so much easier on projects like this.

Edited by lo-fi
Link to comment
Share on other sites

No drama! There is one snag: I have to rig it again because Unity crashed out before I saved. I have the .mu, but that's really not much help! I've got the actual main gear model now though, so I'll get it fully rigged and bundled up for you to poke around with.

My method is at least simple, so long as you follow a few rules when putting the hierarchy together. The plugin is far from finished, but contains the bits you're interested in (though the heavy lifting is all done in .cfg calls) and you can probably teach me a thing or two about the animation stuff!

Actually, do you use GitHub? I've found it makes life so much easier on projects like this.

It's fine, I'm trashing any code now, but I'm probably not going to continue this considering the trouble I've gone through for the results I've gotten, especially since you have your stuff working almost perfectly. What I might do instead of trying to force this to work is put together some part tools for constructing wheels and landing gear in Unity. If I can't make my own system work, I'll make the old one easy to work with, I suppose.

If you want to learn some stuff about animation you can just send me a PM with what you'd like to know, it's pretty easy so I know I can do that without giving myself too much stress.

Link to comment
Share on other sites

I think Spanner just released a demo package like you're describing for rover wheels, so something similar for landing gear would be fantastic.

We will get this working one way or another!

Thanks, I'll be in touch regarding animations :)

Link to comment
Share on other sites

added few notes to the image lo-fi posted on the main landing gear set up. hopefully correct and understandable. :D

what I don't get is how ModuleLandingGear knows which wheel mesh is linked to which wheel collider... the order in the heirarchy? wheelCollider radius determines the rotation speed of the wheel mesh; larger radius = slower rotation speed.

KmiOtTT.jpg

Edited by nli2work
Link to comment
Share on other sites

Simple: Its all done in the config.

I'm not using MLG either, it's my own custom plugin. I'll have a look through notes later - thanks :)

ah right. MLG only accepts one wheelCollider... might still be able to do this with stock MLG... would probbaly have to do some trickery with position constraint to match rotation on the 2nd set oif wheels; definitely more complicated... if possible at all.

Edited by nli2work
Link to comment
Share on other sites

Basically I'm on a crusade to create Open Source, flexible modules for wheels, tracks and landing gear. It's so much easier when you know what the code is doing behind the scenes, rather than having to guess. That, plus a lot of the excellent tools Squad has given us (LookAt etc.) out of the box, means just about anything is possible with a little ingenuity.

I've designed my modules a little differently to stock, in that wheels run their own module individually for rotation and suspension travel, then one master module hooks up user input and stuff like that. It's much more flexible and IMHO much easier to understand. Maybe this clears things up a little:


PART
{
name = LandingGearMainTest
module = Part
author = Lo-Fi


mesh = MainGear.mu




node_attach = 0.0, 0.0, 0.0, 0.0, 1.0, 0.0


TechRequired = advancedMotors
entryCost = 6000


cost = 580
category = Utility
subcategory = 0
title = Landing Gear Main TEST
manufacturer = Kerbal Foundries
description = See if this works...


attachRules = 0,1,0,1,0


mass = 0.5
dragModelType = default
maximum_drag = 0.3
minimum_drag = 0.2
angularDrag = 1
maxTemp = 3600


crashTolerance =3000
breakingForce = 3000
breakingTorque = 3000


MODULE
{
name = FXModuleLookAtConstraint


CONSTRAINLOOKFX
{
targetName = SuspensionTraverseR
rotatorsName = SwingArm
}
}


MODULE
{
name = LandingGearWheel
wheelName = NoseGearWheelsR
colliderName = wheelColliderR
susTravName = SuspensionTraverseR

}


MODULE
{
name = LandingGearWheel
wheelName = NoseGearWheels
colliderName = wheelCollider
susTravName = SuspensionTraverse
}






MODULE
{
name = ModuleLandingGear2
brakingTorque = 70
steeringName = Steering
steeringCurve
{
key = 0 35
key = 5 10
key = 50 2
}
)


}

Good work on the annotation, btw

Link to comment
Share on other sites

Basically I'm on a crusade to create Open Source, flexible modules for wheels, tracks and landing gear.

Indeed, for Gawd** hath ordaineth't that we, the green creatures of this terrestrial body, go forth unto his universe and proclaim the fallacies of the wheel, proclaiming the good news of a new covenant in rolling technology, giving them hope and showing them how badly their old-ways of rolling-around-on-things have done their jobs. I remember that day, as if t'were but a day before, when behold the clouds before us did part ways... and a piece of debris from a failed rocket launch swept from the heavens and obliterated our third companion... whatever his name was, may the heavenly tadpole have mercy on his soul if he had one... and then we went home. But the next day the clouds parted again and we were sore afraid... but instead of death and smashed-ness we were presented with a new vision for the round things we use as landing gear, and the occasional crashing-gear. It was then that I knew we were destined to do great things. Then I belched and fell on the ground. t'was beautiful!

Or was that a really nutty dream I had after a failed orbital insertion left me stranded for three days with nothing but noxious fumes as breathing air? Either way, it was profound.

** GAWD (noun, G-ahh-d, heavily accented replica of a common word for a supreme creator and ruler of the universe)

Link to comment
Share on other sites

Basically I'm on a crusade to create Open Source, flexible modules for wheels, tracks and landing gear. It's so much easier when you know what the code is doing behind the scenes, rather than having to guess. That, plus a lot of the excellent tools Squad has given us (LookAt etc.) out of the box, means just about anything is possible with a little ingenuity.

I've designed my modules a little differently to stock, in that wheels run their own module individually for rotation and suspension travel, then one master module hooks up user input and stuff like that. It's much more flexible and IMHO much easier to understand. Maybe this clears things up a little:

Yep! sure does. Interesting your code doesn't require module ID. all other plugins, ones that I've seen, that utilize multiple instances of same PartModule requires unique ModuleID... eg. Firespitter or RPM

very cool, looking forward to this when you release it

Link to comment
Share on other sites

Yep! sure does. Interesting your code doesn't require module ID. all other plugins, ones that I've seen, that utilize multiple instances of same PartModule requires unique ModuleID... eg. Firespitter or RPM

very cool, looking forward to this when you release it

I'm not sure why they would really need a unique ID except for GUI Windows, but if they had the same ID for one part type it would be pointless...

Definitely going to use your plugin for Sauron's Concept rockets when I get around to his spaceplane. I'm glad that even if my thing isn't going to work there is at least another great option. :D

Link to comment
Share on other sites

Certainly not wasted work, even if you don't continue with it as-is. Made me think, gave me some ideas and another set of really decent code to look over. I can certainly see other applications for stepping the animation like you did, that was absolutely genius.

The concepts are really cool, btw :)

Link to comment
Share on other sites

added few notes to the image lo-fi posted on the main landing gear set up ...

what I don't get is how ModuleLandingGear knows which wheel mesh is linked to which wheel collider...

hello !

May be it's by the parenting :

0iZepLD.jpg

- Jambe_Inf_Principale, manage this wheelcollider, but (and it's I want try) if I create an other Jambe_Inf_Principale

named for example Jambe_Inf_Secondary, with exactly the same hierarchy and objects, but linked separately !

- Keeping this, I want try the example in lo-fi 's picture, thank for the detailed info :wink:

- I have rigged the rear gear of Cpt.kipard, (see in this post for file), and that look very good to test this option!!!

steph

Edit : one thing all my picture are on Imgur, and if I can't stay on this forum, if someone could

take all these pictures and save somewhere just in case ..... (I don't know the time imgur keep picture)

Edited by stephm
Link to comment
Share on other sites

ok thank

I have finished the main gear and it's rigged with the same idea of picture above (in this post, with 2 wheelcollider)

and I have you're front gear and rear gear :cool: in SPH, I'm prepare to test on runway right now

I'm back later :wink:

steph

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