Jump to content

Animation and Physics.


Recommended Posts

Is it possible for an animation to actually affect connected meshes? I've experimented in the past, but just had the part clip through the connected part and act as if it weren't connected. What I need is an animated decoupler that physically moves the connected part(s) away from the anchor. Is this possible with or without a plugin?

Link to comment
Share on other sites

Currently, no. I'm working on it, as is Sirkut, though.

It's to do with the way KSP creates PhysX joints between the parts, which GameObjects is connects either end of the joint to and how the rigidbody physics are applied in KSP. IR and (I believe) the Lazor arm are the only two plugins I know of that work a way around this, so IR may be a way to achieve what you have in mind, but beyond that there's pretty much no option. It's something that needs solving IMO, but it's decidedly non-trivial.

EDIT: I had another poke about this evening and got a little further. It's not going to be easy.

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

  • 1 year later...
On 12/29/2014 at 6:32 PM, lo-fi said:

Currently, no. I'm working on it, as is Sirkut, though.

It's to do with the way KSP creates PhysX joints between the parts, which GameObjects is connects either end of the joint to and how the rigidbody physics are applied in KSP. IR and (I believe) the Lazor arm are the only two plugins I know of that work a way around this, so IR may be a way to achieve what you have in mind, but beyond that there's pretty much no option. It's something that needs solving IMO, but it's decidedly non-trivial.

EDIT: I had another poke about this evening and got a little further. It's not going to be easy.

Do suppose you know how IR and such get around this issue? Currently trying to make a physics based catapult launcher part for an aircraft carrier using an animation for the rail slider to get a smooth acceleration curve. Was wondering if it would be possible to adapt this kind of movement to a modified gantry rail part from IR?

Edited by pingopete
Link to comment
Share on other sites

You're on to a no go mixing physics with animation. 100% not going to work. I messed with this A LOT :/

I think you'd struggle with IR getting the motion you want, but it'll get you further. Not impossible.

A custom plugin would be best if you're prepared to have a headache getting your brain around Unity joints... if I had more time I'd make one.

Link to comment
Share on other sites

On 4/5/2016 at 9:48 PM, lo-fi said:

You're on to a no go mixing physics with animation. 100% not going to work. I messed with this A LOT :/

I think you'd struggle with IR getting the motion you want, but it'll get you further. Not impossible.

A custom plugin would be best if you're prepared to have a headache getting your brain around Unity joints... if I had more time I'd make one.

I've actually managed to get a somewhat reasonable movement out of the IR gantry rail part by giving it unlimited range and tweaking the speed and acceleration options, only two issues remain, further down the track the slider becomes quite unstable and moves around in all directions also sagging down, also while the acceleration works great in one direction it also decelerates at the end at the same rate where really it needs to stop immediately. I was actually kinda proud of my first KSP part though :P I tried using the animation to move a slider hook to which I tried attaching a plane via a atachment hook. To my suprise it actually works pretty well for the first second or so but the plane always glitches into the hook when it starts moving faster :/ 

For anyone interested here some pics:

 

Link to comment
Share on other sites

You're a brave man! 

On 4/6/2016 at 5:19 PM, nli2work said:

@lo-fi IIRC you said IR got around this by breaking/attaching joints every frame?

To be honest I don't know of any game engine that is capable of this.

Yes and no. Not reliably is the honest answer.

1 hour ago, pingopete said:

Snip

Love the tenacity!

Link to comment
Share on other sites

9 minutes ago, lo-fi said:

You're a brave man! 

Yes and no. Not reliably is the honest answer.

Love the tenacity!

I'm more than happy to upload the file if anyone wants to give it a go, even if just for the lolz/ curiosity :)

Link to comment
Share on other sites

14 minutes ago, lo-fi said:

I would, but I'd get all side tracked in creating a plugin to throw planes around, and probably an arrestor wire too :D

I would literally pay money to have someone make a realistic arrestor system and catapult or even just script to slow a given part (attached to plane e.g. nose wheel) when it goes within a certain proximity to the cable (how the nimitz mod works in ARMA). I was actually hoping to port the nimitz mod to KSP, I have all the models and arma scripts they just need reworking I think.

Here ya go anyways ;)http://www.mediafire.com/download/5x8orqr01icktl3/CatapultAnimationTest.zip

Edited by pingopete
Link to comment
Share on other sites

Must..... Resist......

Very cool. Seriously, I need to be getting on with the KF U5 stuff, but messing around with catapults and whatnot is just my kind of thing. I've still got the code for this somewhere (I think):

 

Link to comment
Share on other sites

1 minute ago, lo-fi said:

Must..... Resist......

Very cool. Seriously, I need to be getting on with the KF U5 stuff, but messing around with catapults and whatnot is just my kind of thing. I've still got the code for this somewhere (I think):

 

Hnnnnggg eyes bleeding with joy, mate I will donate to you to work on a plugin no joke! Out of interest is that an instantanious jump to light speed or is it gradual (to an extent)?

Link to comment
Share on other sites

Honestly, I can't remember! Adding forces to an object in Unity is trivial. Doing so and having a craft not rip itself apart may not be so, but that's part of the fun :lol:

I can kinda see how to do it. If I find a few spare hours after I've got the KF U5 stuff working I'll have a play - I just do bits to keep my hand in the coding stuff tbh, and this looks kinda fun.

Link to comment
Share on other sites

Just now, lo-fi said:

Honestly, I can't remember! Adding forces to an object in Unity is trivial. Doing so and having a craft not rip itself apart may not be so, but that's part of the fun :lol:

I can kinda see how to do it. If I find a few spare hours after I've got the KF U5 stuff working I'll have a play - I just do bits to keep my hand in the coding stuff tbh, and this looks kinda fun.

Well you've shown you have the ability and scripting knowhow.. soooooo ;D But seriously if there's anything I can do, let me know!! Would absolutely LOVE  to see this become a reality :)

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