Ranking
Original Post
Any way to get the level of "extension" for a joint??
In toribash it looks like after a joint's state is toggled to contracting (or extending), a force or torque is applied along the joint in one direction; as you progress some frames, you see the connected bodyparts will move appropriately until that joint's LIMIT is reached.

For example, when you extend the knee joint, the knee locks eventually to stop your joint from overextending; if a joint is fractured, these limits are ignored and you see the leg keep moving past the limit in a gross looking way.

What I want to know is: is there ANY way at all to figure out how "extended" or "contracted" a given joint is?

What I want to do is have a function return a value from 0 to 1, with 0 meaning the joint is completely extended (like the starting position, jumping jack pose), and 1 meaning the joint is fully contracted (like when the force from the joint can't bring the two connected bodyparts any closer than they are).

Anyone have any ideas, did I overlook something really obvious?
Thanks
well, you can mod how much the joints can move, dont know anything else about it though.
Originally Posted by DesertPunk View Post
look out for walruses!

Originally Posted by Karhax View Post
well, you can mod how much the joints can move, dont know anything else about it though.

How?
I believe you could just make a function that calculates the angle between two bodyparts. Do it with two adjacent bodyparts and there you go, angle/180 is a number from 0 to 1 giving the state of the joint.

That should work, right?
Well no. The joints dont go exactly 180 degrees. Some go more, some go less.
i have a totally post modern tattoo of a scalene triangle.
<DeadorK> fair maiden
<DeadorK> if the cum is going to be in your mouth
<DeadorK> it shall be in mine as well
Exactly, I first thought of the idea Jok suggested but that only applies to cases where the joints normal range of motion is from 0А to 180А. I'm really not sure what the exact joint limits are for the glutes or ankles or wrist (or chest), but if different joints have different limits then an extension value has to be in relation to a specific range of motion.

I guess this isn't something you can easily do with the available lua functions, since nothing in the SDK mentions anything about what range of motions are available to which joints, although it seems obvious that most of the joints are functionally "hinge" joints, because they work in one plane, and have the dimension of forward and backward.

Whats unusual is the chest joint since it actually flexes by rotating rather than hinging back or forth; still, its motion is one dimensional and limited to a specific range like the other joints, so theres nothing stopping Hampa from making the current extension of the chest available to a script either.

Somewhere in the physics/movement code, Hampa HAS to have some code that checks if the joint will move outside of its limit and prevents it from freely moving that way; thats how fractures work in Toribash, by turning that limit off.

Ideally, Hampa will provide some LUA function that returns the current extension/contraction of a joint, or at the very least, he might be considerate enough to explain how one might implement their own.
joint r_knee
radius 0.14
pos 0.8 1.0 0.8
axis 1 0 0 <- direction it moves
range 2.3 0.0 <- i think this is what your looking for
strength 4.0 <- this is how hard it moves
velocity 40.0 <- this is it's top speed

from DefaultToribash.tbm
Originally Posted by MrPoptart View Post
joint r_knee
radius 0.14
pos 0.8 1.0 0.8
axis 1 0 0 <- direction it moves
range 2.3 0.0 <- i think this is what your looking for
strength 4.0 <- this is how hard it moves
velocity 40.0 <- this is it's top speed

from DefaultToribash.tbm

Thanks!!

Thats one half of the puzzle solved; I know the range of motion for all the joints.
Now I've just got to do some testing with coordinates to make my little function robust enough to work on any joint and I should be set.