Object Rigidbody Physics (Animation post followup)

When discussing the animations in the comment section of my object animation post, @MoltonMontro suggested the awesome idea of employing physics into Unturned objects. Here are the results of my tests:

Using hinge joints, I made a swingset with interactable swings. (NOTE: Only vehicles, not the player can’t affect the swings, I’m not sure why but I think it’s the same reason players can’t affect vehicles by walking into them)

Disabled gravity

Using break force I managed to make a destructible version :smiley:

As you can see here players can’t affect them at all.

Cube object with rigidbody physics:

Tutorial: Same hierarchy as for animation, but dont rig it this time. Rather have a parent model with child models attached to it with hinge joints and rigidbodies attached to them (parent shouldn’t use gravity and should be kinematic, check YT for tutorials on hinges if you are familiar with them) Both box colliders and capsules work, but don’t give either a physics material (doesn’t work as far as I have tested) If you have destructible parts, make sure to tag/layer them as Vehicle or a similar tag that can collider with the ground

If you want to take a closer look at how it’s made, you can import this Unitypackage (version 5.51f1) and play around with it how much you want!

https://www.mediafire.com/file/9ikvme8im2iugku/Rigid_Swings.unitypackage
For the one who has no trust in me: https://www.virustotal.com/#/url/9be40a9837d7dfc02b796c5e69b1a1604d8a14b13ad132229a70cba654cb708a/detection (virus scan of Unitypackage)

Sorry for the amount of edits on this post.

Might update this post tomorrow with more objects, be sure to leave a suggestion if you have one! :slight_smile:

15 Likes

You did a really good job on this, maybe this sort of stuff will find it’s way into 4.0?

3 Likes

That’s really cool, good job!

1 Like

I really like how you made them work, good job!

(inb4 nelson adds this)

1 Like

Hopefully!

1 Like

Good stuff.

I wonder what makes grasses move when walking through them though. :thinking: Too lazy to mess around in-game at the moment to see for sure, but I assume it might just be part of the “wind calculations” so it can be easily disabled for lower-end computers. Probably can’t be utilized in mods then, at least not for things with collision.

3 Likes

:thinking: Indeed

1 Like

how 2 brok gaem :thinking:

2 Likes

I knew someone will get it how to add physics for objects using rigdbodies xD

1 Like

Iam pretty sure grass have it own script and its not possible to use that in mods

1 Like

xD maybe you could have added them before me? :open_mouth:

1 Like

It is just a part of the wind calculations. Trees could probably do it to, if they were setup the same as grass. Assuming it was just based on the tag used, then you could still make use of wind calculations (and grass parting) through some iffy workarounds regardless.

Either way, it is totally possible to use in mods. You can do it when you make your own grass, and you can likely do it without the usage of modules by tagging stuff differently.

2 Likes

There arent any “wind physics” at work in Unturned. The reason trees and grass sway, is a shader that causes their vertices to move on screen. The script that nelson uses to move grass out of the way is simple, its a capsule collider around the player model. It’s visible if you make very short or long custom grass. All it is is a script that tells the grass model to bend around the capsule collider, not any sort of physics.

4 Likes

How do you know all this? :thinking:

2 Likes

well it needs little bit unity/coding knowledge :smiley:

why isnt this implemented yet

@SDGNelson hasn’t probably found a reason to implement this yet, he might have experimented with it too but maybe just sees it as a gimmick.

Well that was really cool, and this is also a good idea too.

Could probably put it on shopping carts (and add shopping carts), but people would just dump them in the ocean. :confused:

2 Likes

That’s actually a fantastic idea