|
|
Ragdoll and phcon_getposition
#266355
05/17/09 16:29
05/17/09 16:29
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
OP
Serious User
|
OP
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
Ok, my thread is a week old and it seems no one has a real solution. Ok, my idea was to create a ragdoll with a visible model8the player model) and an invisible bonestructure created out of entities(box form) which have physic properties.
Now i want to sync the rotation of the bones of the Model with the rotation of the constraints of my invisible Physic skelet.
When i use only ONE axis per bone(for example only tilt instead of tilt AND roll for a shoulder) everything is working 100% fine. But as you know, a shoulder rotates around 2 axis, not one.
So for a shoulder iam creating 2 hinges(since PH_ball isnt working with phcon_getposition), one for tilt and one for roll. These values are used to rotate the bone of the shoulder. But that doesnt work the way i thought it would. The bones are offset(sometimes really heavy). So there is something wrong with my rotation algorythm.(when using only one axis i can simply use the rotation of phcon_getposition to rotate a bone directly without problems, but with two axis per bone it doesnt work correctly).
So my Question: what is a good way to sync the bones of a Model to a ragdollskelet?
Hope someone has a good solution.
Greets Rackscha
MY Website with news of my projects: (for example my current Muliplayer Bomberman, GenesisPrecompiler for LiteC and TileMaster, an easy to use Tile editor) Sparetime-Development
|
|
|
Re: Ragdoll and phcon_getposition
[Re: Pappenheimer]
#266373
05/17/09 19:24
05/17/09 19:24
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
OP
Serious User
|
OP
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
i have done this the red circle shows my construction for a shoulder. the small thing rotates around thex-axis and the big one around the y-axis The only problem ir that i cannot sync the rotation of this construction to the bones. Greets Rackscha
MY Website with news of my projects: (for example my current Muliplayer Bomberman, GenesisPrecompiler for LiteC and TileMaster, an easy to use Tile editor) Sparetime-Development
|
|
|
Re: Ragdoll and phcon_getposition
[Re: jcl]
#266476
05/18/09 11:10
05/18/09 11:10
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
OP
Serious User
|
OP
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
Ok, thank you. I'll try to figure it out  Oh and the only example i have found was the one from helghast and he is using only one axis per bone  EDIT: oh and how shall i use ang_rotate? should i save the rotation ov the ent when created, then using ang_rotate with the angles saved at start or do i have to subtract the current angle with the start angle? EDIT2 @Papenheimer: It should fall and collide like a real body 
Last edited by Rackscha; 05/18/09 13:19.
MY Website with news of my projects: (for example my current Muliplayer Bomberman, GenesisPrecompiler for LiteC and TileMaster, an easy to use Tile editor) Sparetime-Development
|
|
|
Re: Ragdoll and phcon_getposition
[Re: Rackscha]
#266846
05/20/09 10:04
05/20/09 10:04
|
Joined: Jul 2000
Posts: 27,967 Frankfurt
jcl

Chief Engineer
|

Chief Engineer
Joined: Jul 2000
Posts: 27,967
Frankfurt
|
I got your PM, but will answer here. In fact it's a nontrivial problem.
The idea of a ragdoll is that you just take a model with bones and assign the ragdoll action, without any complicated setup. Thus, the box entities with their initial angles must be automatically generated from the initial bones orientation, which can be done with vec_to_angle.
The problem: for rotating the bones you need to know the angle difference between this initial box angle, and the final box angle after a physics collision. You must then rotate the bone by this angle difference.
For getting the angle difference, you can't just subtract the angles. You must convert the angles to matrices, then multiply the inverse of the initial matrix with the final matrix. The result is a matrix representing the angular difference. You must then convert this back to Euler angles. Those are finally the angles for rotating the bones.
Unfortunately, the functions for converting angles to matrices and back are only available in the newest beta. So if you want to go that way, you need to wait until the release of the next version.
|
|
|
Re: Ragdoll and phcon_getposition
[Re: jcl]
#266851
05/20/09 11:07
05/20/09 11:07
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
OP
Serious User
|
OP
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
ah, okay thx, the matrix way includes the way of using the constraints angles? Because in the manual, it says that a constarint angle is 0 at the beginning(independent of the objects rotation which is attached to the constraint)
So i thought i could simply "apply" the angles of comstraints to bones. mhh
Ok i see i'll have to wait. Hope the next version will be released soon^^
Greets Rackscha
MY Website with news of my projects: (for example my current Muliplayer Bomberman, GenesisPrecompiler for LiteC and TileMaster, an easy to use Tile editor) Sparetime-Development
|
|
|
Re: Ragdoll and phcon_getposition
[Re: Rackscha]
#267358
05/23/09 13:19
05/23/09 13:19
|
Joined: Jun 2008
Posts: 151 Ukraine
XD1v0
Member
|
Member
Joined: Jun 2008
Posts: 151
Ukraine
|
oh and how shall i use ang_rotate? should i save the rotation ov the ent when created, then using ang_rotate with the angles saved at start or do i have to subtract the current angle with the start angle?
I use this algorithm(this code rotate any bone to bang)
ang_for_bone(c_bang,this,bone_name);
vec_set(inv_ang,vector(360-c_bang.x,0,0));//& find invert angle of bone
ang_add(inv_ang,vector(0,360-c_bang.y,0));//&
ang_add(inv_ang,vector(0,0,360-c_bang.z));//&
ang_add(bang,inv_ang); // mix invert angle and angle what need to set
ent_bonerotate(this,bone_name,bang);// now bone angle = bang
Rackscha for ragdoll not necessarily use phcon_getposition if you want create ragdoll. For example: some bone attached to center of physic entity, this entity constraint(phcon_add) with another ph entity, so in this way you can create ragdoll adding ph entities and set entity position to bone position For better understanding use THIS code
Last edited by XD1v0; 05/23/09 13:34.
A7 Commercial Celeron 1700, GeForce 5500 FX 256mb, 1 Gb Ram
|
|
|
Re: Ragdoll and phcon_getposition
[Re: XD1v0]
#267588
05/25/09 09:06
05/25/09 09:06
|
Joined: Jan 2004
Posts: 3,023 The Netherlands
Helghast
Expert
|
Expert
Joined: Jan 2004
Posts: 3,023
The Netherlands
|
I have this problem solved, with help of darkinferno. I created a whole system for easily creating ragdolls, just waiting for darkinferno's approval to upload it. Completely written in A7 lite-c  You'll see soon enough  just wait a couple days. regards,
|
|
|
|