Jump to content

[Tutorial] Animated Landing Leg w/ Suspension


Recommended Posts

I tried using AnimateGeneric in place of the landing leg for my part just to see if it would play all 4 animations - it did not, it displayed the same behavior so its definitely some sort of bug or limitation of the animation module(s)

I also tried duplicating the objects in Unity and putting them in unique hierarchies (legRoot2, 3 and 4) and it also had the same issue.

--

re: legs without suspension

HLandingleg is pretty broken at this point, the tweakables and right-click menus don't work but G-key toggle does work (somewhat)

Using the AnimateGeneric is the better choice since its a module. It doesn't include automatic G-key operation but people can add it to the proper action group manually in the VAB to get that. Its tweakables do work, and you can set custom text for their menu. I have 3 or 4 old leg parts in Novapunch I need to redo in this manner.

Link to post
Share on other sites
I have two problems that I can't seem to solve.

The first is that my legs are always resting at the point where the Wheel Collider hits the ground, even if the legs retract, they still hover above the ground. It seems like for whatever reason that game is using the Wheel Collider as a normal collider. I've made sure that both my pistonCollider and wheelCollider are in the proper place in the heirarchy.

Secondly, my pistons always want to retract to the upper suspension limit if there's any weight on them at all. I can see them move around if I hack gravity, but when I'm on the ground they instantly slide to the upper limit. I've tried changing the spring and damper values to several different things, but that doesn't seem to solve the problem.

Did you ever solve this? I'm having the exact same problem, with (as far as I know) everything correct.

Link to post
Share on other sites
Using the AnimateGeneric is the better choice since its a module. It doesn't include automatic G-key operation but people can add it to the proper action group manually in the VAB to get that. Its tweakables do work, and you can set custom text for their menu. I have 3 or 4 old leg parts in Novapunch I need to redo in this manner.
Cool. So, just use Anmation Generic, not Landing Leg modules, and add it to AGs manually? Got it.

You can actually get G to activate them with AnimateGeneric, you just have to make sure the animation name is called "Retract", that's how the old ones did it.

Edit: Nevermind that, I got stuff mixed up.

Edited by StarVision
Link to post
Share on other sites
Did you ever solve this? I'm having the exact same problem, with (as far as I know) everything correct.

He hasn't gotten back to me so I don't know what the problem is yet. Like I asked him, if you could send me the unity files I could take a look.

Link to post
Share on other sites
Hmm, that shouldn't happen, since any animation could be named such, even if its for an antennae or something.

Wait, you're right, I just remembered mine working fine with AnimateGeneric. I looked back at the config file and I have that as well as HLandingLeg as the module. My bad, but what's so bad about using this method? It doesn't seem broken, I haven't encountered any errors yet.

edit: for added clarity, I'm using both methods.:

edit2: Actually disregard everything I've said, It's a hacky way of doing it and it doesn't work properly in certain circumstances.

Edited by StarVision
Link to post
Share on other sites
  • 3 weeks later...

I'm having trouble getting a piston to work properly.

Javascript is disabled. View full album

basically, when the leg is fully deployed, the piston and the Foot (which is its child) are pushed up, even past their beginning position. The actual colliders stay in the right place, and the suspension even works (it'll compress and decompress via torque from areactionwheel) so its only lowerPiston and Foot that is offset.

The origins of the objects are lined up as they should be, and the wheel colliders suspension distance is long enough. No tweaking really seems to change how it works.

I don't get it.

Link to post
Share on other sites

Okay, I seem to have passed that issue, it was being caused by the Foot object having a Mesh Collider. Removed the collider and the foot stopped popping up as soon as the animation finished.

Except, that broke the functional suspension, and now I have the same issue the others had, as soon as the legs hit the ground, they collapse all the way to the upper limit amd beyond, the bottom of the piston seems to be sitting on top of the wheel colliders starting position.

Changing the suspension length, upper limit, spring or damper doesn't seem to do.. much.

Edit: Okay got it working - my issue was having the wheelCollider outside of the animation heirarchy. Its fine to do that, but you need to make sure you set up the collider's transform and suspension length for the lowerPiston's position AFTER the deployment animation completes. I added a pic to my album to show how I moved the wheelCollider down to set up the suspension travel properly.

Edited by Tiberion
Link to post
Share on other sites

Oops I didn't see this post before I sent you a PM, tiberion. I tried that solution with the Odin leg and it didn't work; the leg always hovered above the ground because the suspensionTransform (lowerPiston) can't be animated. You can animate the parent of it though.

The working hierarchy was as follows:

upperPiston(rotating animation)

=lowerPiston(sliding animation, no mesh, no collider)

= = wheelCollider (WheelColliders layer)

= = piston(mesh, no animation, suspensionTransformName points to this)

= = = foot(rotation animation, mesh)

= = = pistonCollider (WheelCollidersIgnore layer)

Link to post
Share on other sites

I sent you a reply, too. I went back and looked and its working the way I have it setup in the last screenshot there. lowerPiston and Foot and both animated in Blender, and its the piston Transform.

if its floating above the ground but moving with the suspension travel then it probably means the wheel radius is too big or the suspension sticking down too far below the foot. If it get displaced up and doesn't move, then either the wheel collider isn't positioned properly to be in place after deployment, or there are other colliders (perhaps one on the foot like I had) that the wheel collider is hitting and displacing into weird placed like you see in other screenshots.

Using an enpty parent to animate is a good idea though, and should be done. I'll definitely do it next time just to make it easier to manage.

Link to post
Share on other sites
  • 4 weeks later...

I might try to make my first part using this tutorial. for a newbie like me all this seems impossible, but I'm in need of a set of legs for my robots!, legs with grip and suspension, and a bigger foot ^^

thanks a lot for the time spent Bahamuto!

Link to post
Share on other sites
  • 2 months later...

Ugh, if I can ignore it, why's it an error....

I've been trying to get this to work, http://www.gfycat.com/FlakyLoneGelding

I've determined that getting the animation to play all the time means setting up the legs right so the leg module doesn't break.

But, I think I've ran into an issue where getting 4 legs to work on 1 part seems impossible, one leg seems fine, but more than that seems not so fine.

Link to post
Share on other sites
Ugh, if I can ignore it, why's it an error....

I've been trying to get this to work, http://www.gfycat.com/FlakyLoneGelding

I've determined that getting the animation to play all the time means setting up the legs right so the leg module doesn't break.

But, I think I've ran into an issue where getting 4 legs to work on 1 part seems impossible, one leg seems fine, but more than that seems not so fine.

yeah that's the trend with stock modules... multiple modules of the same on a single part usually is bad news.

Link to post
Share on other sites

Have a look at ZodiusInfuser's IR model rework thread, he's working on something similar with 4 feet. Might be able to give you some pointers, though I'm not sure he's past the modeling stage yet.

The warning is to do with the way KSP applies rigid body physics. As far as the collider is concerned its not attached to anything that has any when its enabled. It does, however, give you a nice indication that the collider is enabled and working

Link to post
Share on other sites
  • 3 months later...
  • 5 months later...

Just wanted to say THANKS!

Still had a bit of trouble sorting out how I wanted MY legs to work, but, on the whole, this tute was exactly what I needed.

Someone needs to compile a list of layers, transforms, etc and how they work with the various modules in KSP. It won't kill the need for tutes like these, but it'd be an awesome reference for parts of a type you've done before, ages ago and just need a refresher on which axis goes where etc. It'd be nice to think that someone should be Squad. But I know it'll be one of us.

Link to post
Share on other sites
I suspect we may need updated tutorials once the Unity 5 KSP comes out, since the wheel collider system is being replaced.

Updated everything tutes once U5 KSP comes out. What's currently probably doing in the heads of Squad devs will be doing our heads in after release. Yay! :-(

Got legs mostly working, but I think my foot isn't moving with my suspension. Looks fine when not lifting a lot of weight, but given what it should be supporting, the feet essentially disappear into the ground suggesting they're not properly assigned. http://imgur.com/a/MbeIe

Not asking for help, I haven't double checked all my layers n stuff just yet, just venting. Folding legs with suspension are is tricky.

Link to post
Share on other sites
Oops I didn't see this post before I sent you a PM, tiberion. I tried that solution with the Odin leg and it didn't work; the leg always hovered above the ground because the suspensionTransform (lowerPiston) can't be animated. You can animate the parent of it though.

The working hierarchy was as follows:

upperPiston(rotating animation)

=lowerPiston(sliding animation, no mesh, no collider)

= = wheelCollider (WheelColliders layer)

= = piston(mesh, no animation, suspensionTransformName points to this)

= = = foot(rotation animation, mesh)

= = = pistonCollider (WheelCollidersIgnore layer)

Some questions;

Is this still working for 1.0+? If not, then the following questions are moot.

Your lowerPiston(sliding animation, no mesh, no collider), is that an empty game object or ? And assuming an empty transform, which axis points at the ground and where is it centred? I can't find references to it in the posts here, and for some reason I can't open the zipped unity file (blender etc work fine, I think something's changed in Unity since it was saved).

I probably need to verify which mesh is which. My assumption is that there's the foot, rotates on X, Y points at ground. It's connected to the lower piston, or "piston" mesh in the heirarchy above. That slides up and down inside or outside the upperPiston. Then that collection may be animated to place it in position to function, or to retract it, via parent objects like arms etc.

My heirarchy (which isn't working) is;

Legs (game object, KSP Part tools etc)

=Legs(Imported Blender object, has the animation and parents the other meshes)

==Base (does nothing, just the attachment point)

===PistonBody (ignore that it says Piston, this is just an animated part for a piston arrangement to extend the MainLeg mesh. Mesh only)

==MainLeg (animated mesh of long arm that folds out)

===LegCollider (collider matching MainLeg)

===PistonRod (ignore that it says Piston, this is just an animated part for a piston arrangement to extend the MainLeg mesh. Mesh only)

===UpprSuspension (mesh, animated, top of shock absorber, coincides with upperPiston)

====Suspension (Emtpy, no mesh, pointed Y down, coincides with lowerPiston)

====wheelCollider (wheelColliders layer, centred at UpprSuspension root, projects down slightly past foot)

====LwrSuspension (mesh only, suspensionTransformName points to this. expectation is this would move up and down with foot, forming inner/lower section of shock absorber)

=====PistonCollider (WheelCollidersIgnore layer, centred at root of UpprSuspension, capsule collider, covers about half the distance to foot)

=====Foot (mesh only, no collider, referenced as foot in cfg)

Kinda hoping someone can spot a glaring error I can't see. :-)

Link to post
Share on other sites

For any useful kind of diagnosis, screen grabs are really required. Even better, create a Unity package of your scene, model and any materials/textures you're using by selecting them, right clicking and selecting "export package". Assuming you're using 4.2.2?

Link to post
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...