Jump to content

Help with jumping parts with colliders


Recommended Posts

Hi all,

I am trying to track down an issue I have with a part that jumps into the air as soon as you launch it from the VAB. Any ideas about what could cause that? The part in question has some colliders on its feet and it only seems to happen with the legs fully extended. I have a screenshot below of the unplanned liftoff and the part as seen in Unity.

PS1wu0A.png

Has anybody had similar problems?

Thanks for the help. :)

Link to comment
Share on other sites

it happens when you extend the legs in VAB then launch? or it happens when you extend the legs after launch and it jumps up as the legs extend across the ground?

if it's the 2nd, it's probably the colliders building up tension while trying to slide across the ground.

Link to comment
Share on other sites

Have you setup the mass in your .cfg file to near it's final value yet? If you've just got a placeholder value there for now, you might give some thought to what the final mass should be and go ahead and rough that number in... if the thing gets heavier you may find the jumping diminishes to acceptable levels.

Other than that... I'd think about slowing your animation... and perhaps animating your colliders separately so they can travel straight up and down, even while the legs slide outward on deployment.

Link to comment
Share on other sites

Thanks for the comments. :) I start by adding the part to the craft in the VAB and then extend the legs in the VAB. The new ModuleAnimateGeneric lets me do that in the VAB. After the legs are fully extended, I launch the craft. Out at the pad, the scene loads and it appears like the feet have sunk into the grill on the pad a bit before physics loads. Once physics loads, the craft leaps into the air. I think it may have something to do with the cubic colliders on the feet, because the origin point of the cubic colliders is in the center of the cube, but I don't know if that is a factor. I am wondering if that could be the problem. Interestingly, if I start with the legs retracted in the VAB, then launch the craft, then it sits on the main body collider with no problem. Additionally, extending the legs is not a problem, the craft does not go flying. Only thing I can think of is that the main body collider is at origin 0,0,0 and the colliders are not at 0,0,0. Would that make a difference? Modelling for KSP can be so hit or miss at times, so I appreciate all the help I can get :)

Link to comment
Share on other sites

ok, yeah I think you have it right. The feet colliders are partially intersecting terrain collider during load, then physics kicks in and pushes the craft in the direction of CoM so the colliders are no longer intersecting.

Ok, that makes sense. Do you have any suggestions on how to stop that from happening? Is there something I am doing wrong to create the situation where the colliders intersect with the ground on physics load? I wonder if the origin point of the foot colliders needs to be 0,0,0.

FYI, the .fbx and unity files for the part are on my github page if you'd like to play wirh it. The filename is MBU.fbx

Edited by Angel-125
Link to comment
Share on other sites

I don't think the pivots of the feet colliders has to be at the world 0,0,0. I'm assuming it's at the center of the feet collider box at the moment? maybe try setting the center to the bottom of the feet and see if that makes a difference.

Link to comment
Share on other sites

Well this is really frustrating. I tried changing the origin point on the collider boxes to be on the bottom of the box and past the origin point, but to no avail. Here is an album showing what is happening; I left the mesh renderer on the colliders so I can see them in game. The same behavior occurs without the mesh renderer components.

Javascript is disabled. View full album

Link to album

Here is a link to the FBX file, I definitely need some help with this.

Link to comment
Share on other sites

whats your part config..

try adding box collider component to the Foot001~004 objects. no need to change the size or center of the box colliders, they will automatically best fit the foot object. you can set the X and Y to 1.2 if you want the box to include the toes. the large boxes you made in Max can be removed, the left over animation curves can be removed without breaking the animation.

Edited by nli2work
Link to comment
Share on other sites

I'd also appreciate a look at the .cfg file.

And, dumb question, but I've screwed it up before... if you're still using those box colliders, are you setting them as convex?

My gut instinct would be to try using 'ModuleLandingLeg' and wheel colliders, like the stock legs do... but I'm not sure how building 4 of those into one part would work out, because I haven't tried it.

Link to comment
Share on other sites

whats your part config..

try adding box collider component to the Foot001~004 objects. no need to change the size or center of the box colliders, they will automatically best fit the foot object. you can set the X and Y to 1.2 if you want the box to include the toes. the large boxes you made in Max can be removed, the left over animation curves can be removed without breaking the animation.

Thank you for the suggestion. :) I tried removing the colliders I created in MAX and instead added a box collider component to the feet. Unfortunately, the feet fall through the grates and never collide with the ground. I updated the MBU.zip file with the file configuration though. Thank you much for the help. :)

Link to comment
Share on other sites

try setting USI_BaseAnchor offset to 0 instead of -1. I suspect it's changing the spawn position of your part.

Oh, that's interesting. I wonder for the sake of testing if that module were removed so there is ni base anchor or inertial damper... Have to try that when I get home. Really helps to have another set of eyes looking at this, thank you :)

Link to comment
Share on other sites

Well, I tried removing all the modules in the mbupart.cfg file except for ModuleAnimateGeneric, and I'm still seeing the same thing: the box colliders aren't being recognized by the ground, the MBU is resting on the main body, and retracting the legs causes the craft to jump into the air. Only thing I can think of is that KSP doesn't like the animation, but I'm not sure.

Link to comment
Share on other sites

yeah it's something with the animation, but I don't know what. I recreated simplified animation in Unity and it no longer drops down into the launch pad.

I would go back to Max, fix the scale on all the parts (they are all over the place) so everything is 1,1,1. recreate the animation, make sure to set the keyframe filter to only key rotation for parts that only rotate; and key position only for parts that only move. do not keyframe any scale at all.

export and run through the Unity hoops again, and see what happens in KSP.

Edited by nli2work
Link to comment
Share on other sites

Thanks, I will give that a try. I also tried no animation and legs extended. That worked so maybe the legs need to start extended if your suggestions don't work. I will definitely reset the scales, didn't think of that.

out if curriosity, how did you recreate the animation in Unity?

thanks again. :)

Edited by Angel-125
Link to comment
Share on other sites

new animation clip. I only animated the leg pistons rotating out and extending. didn't animate all the toes.

Curious. I wonder why creating a new clip works while the MAX animation does not. Oh well, I will reset the mesh scales and make sure mesh scaling during animation is disabled.

Link to comment
Share on other sites

I have no idea. just too many things to check if you really want to see what went wrong. It'd take much less time to redo everything while making sure scales are reset and animation has no extraneous keyframes.

Well, I did that and didn't see any differences unfortunately. What I ended up with is reversing the animation so that it starts deployed. If I do that then the part doesn't jump. I think it has something to do with exporting the animation from MAX to .fbx.

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