Ragdoll Physics

Im wondering how to make objects "ragdoll". Like D rings that move when you go over rocks, or under acceleration, on incline . Also things like winch rope dangling etc.

@Forces

I saw this in the HHR code classes/trucks that you shared with me.

<Body
Collisions="None"
ImpactType="Truck"
Mass="5"
ModelFrame="Dice_cdt"
>
<Constraint
AxisLocal="(1;0;0)"
MinLimit="-30"
MaxLimit="30"
Type="Hinge"
/>
</Body>

i tried this, making the dice_cdt a bone that is aligned at the pivot of my object, and skinning and weighting the entire object at "1" to the bone, then inserting aforementioned code, and no go, shouldnt expect it to go that easy i know.

Am i weighting wrong? Missing code in trucks/meshes?

Insight greatly apperciated.

@terminatorx58 hey its not a weight issue, im linking the mesh of the dice directly to the Dice_cdt mesh here are some pictures and code of to make the Dring

0_1552585961761_Imagen3.png
as you can see the Mesh of the Ring is directly Inside of the _cdt mesh for the ring animation
on the Right you can see the Hierarchy, by naming a mesh _cdt with this end code you can let the game know thats a cdt mesh and also the rotation point of the Ring depends on the origing/pivot point and axis of the _cdt its better to work on local view of the axis of the meshes (i dont know if 3dsMax has something similar but)

here is the code of it

	<Body
			AngularDamping="0.5"
			Collisions="None"
			ImpactType="Truck"
			Mass="5"
			ModelFrame="FrontORing1_cdt"
		>
			<Constraint
				AxisLocal="(0;1;0)"
				MinLimit="-184"
				MaxLimit="33"
				Type="Hinge"
			/>
		</Body>
		<Body
			AngularDamping="1"
			AngularDamping="0.5"
			Collisions="None"
			ImpactType="Truck"
			Mass="5"
			ModelFrame="FrontORing2_cdt"
		>
			<Constraint
				AxisLocal="(0;1;0)"
				MinLimit="-184"
				MaxLimit="33"
				Type="Hinge"
			/>
		</Body>

@Forces

Got it figured out thanks alot man! What is the difference in the setup up if you want to do something dangling like a hanging rope?

@terminatorx58
Pretty sure that's going to be basically the same idea except you'll want to change the hinge to ragdoll. If it's anything like the big whip antennas I've seen, I hear the weighting is a lot of trial and error to get it to both look and behave correctly. Don't quote me on any of this though, as I'm a novice when it comes to IK in Mudrunner. I expect to be corrected by @Forces very soon... lol

@Mexican_420 ragdoll is its own Type? Hmm ill have to try it. Definitely a novice myself! Thanks man.

last edited by terminatorx58

ropes are harder because they require 2 or more cdts (for realism)
here is how to make a antenna and the idea is the same for a smaller rope
@Mexican_420 yeah antennas took a bit of practice to get it right back when i did the Jeep LJ8 but now its really easy because i made the setup much more simple

the setup is like making a spring (a subdidived cylinder with a gradient of weight/skin from top to bottom and viceversa)

0_1552653581467_Imagen1.png

and the code is similar but it uses motors contrains instead of just a angular damping
a rope is the same idea idea and same with mudflaps

	<Body ImpactType="Truck" Mass="10" ModelFrame="Antenna_cdt">
			<Constraint Cone="40" TwistAxis="(0;0;1)" Type="Ragdoll">
				<AllMotor Damping="1" Spring="400" Type="Spring" />
			</Constraint>
	</Body>

@Forces

Thank you my friend!!! Very much appericiated!!

@Forces
So the antenna mesh shown above has one bone at the base, and the weights are graduated from 1 at the base to 0 (or slightly higher if you want a stiffer antenna) at the tip?

last edited by Mexican_420

yeah its 2 bones, one for the values of the top of the antenna and one for the base and they work just like a spring gradient, not the value of 1 should be the top of the antenna and same as the bottom

Asked by @Mexican_420
How to Make a Winch hook move around

Just like the antenna the code its similar and its also a mix of the O rings because its no a ragdoll code but a TwistAxisLocal and PlaneAxisLocal to control the movement in both X and Z axis
0_1553874406041_Imagen1.jpg
as you can see in image, the Winch_cdt is parallel to the ground adn the winch cable is weighted on both ends just like the antenna to the base of the winch and the winch_cdt (wich control the animation of the winch)
0_1553874535316_Imagen2.jpg
0_1553874722239_Imagen3.jpg

the Weight/skin of the Winch is a gradient on both ends (like a spring)

Code
<Body Collisions="None" Mass="5" ModelFrame="Winch_cdt">
<Constraint
PlaneAxisLocal="(0;0;1)"
PlaneMin="-90"
TwistAxisLocal="(1;0;0)"
TwistMin="-180"
PlaneMax="90"
TwistMax="180"
Type="Ragdoll"
/>
</Body>

the can rotate on both axis at the same time and the max angle of them is controlled in the Min and Max declarations (it gives far more control than the Ragdoll constraint)

@forces
Luckily I was able to accomplish the desired results using a basic ragdoll constraint (in my setup the winch rope is static and only the hook itself is animated). Excellent info to have available for reference on future projects, though! 👍