Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
4 registered members (AndrewAMD, Quad, soulman3, Ayumi), 675 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Ragdoll and phcon_getposition #266355
05/17/09 16:29
05/17/09 16:29
Joined: Dec 2008
Posts: 1,218
Germany
Rackscha Offline OP
Serious User
Rackscha  Offline 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: Rackscha] #266364
05/17/09 18:43
05/17/09 18:43
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
You could add an additional entity to your invisible bonestructure out of boxes for the shoulder with one hinge to tha arm and one to the body. It needs no connection to any bones, thus it is absolutely invisible, but you won't have two hinges at the same place but a bit apart.

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 Offline OP
Serious User
Rackscha  Offline 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: Rackscha] #266418
05/17/09 23:09
05/17/09 23:09
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Ah okey. What do you need the ragdoll for? Means, what sort of situations should it be able to manage?

Most probably, it is better that the bones don't follow the movement of the boxes _exactly_ but in a way that anybody doesn't notice that it doesn't fit with the physically moving boxes.

Re: Ragdoll and phcon_getposition [Re: Pappenheimer] #266458
05/18/09 06:33
05/18/09 06:33
Joined: Jul 2000
Posts: 27,967
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,967
Frankfurt
There are some ragdoll examples by other users.

When you rotate a bone according to an entity orientation, either make sure that the unrotated entity has exactly the same orientation as the unrotated bone. Or use ang_rotate. Otherwise the rotation will end up wrong.

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 Offline OP
Serious User
Rackscha  Offline OP
Serious User

Joined: Dec 2008
Posts: 1,218
Germany
Ok, thank you.
I'll try to figure it out smile

Oh and the only example i have found was the one from helghast and he is using only one axis per bone wink

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 wink

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 Offline

Chief Engineer
jcl  Offline

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 Offline OP
Serious User
Rackscha  Offline 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 Offline
Member
XD1v0  Offline
Member

Joined: Jun 2008
Posts: 151
Ukraine
Quote:
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)
Code:
        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 cool
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 Offline
Expert
Helghast  Offline
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 smile

You'll see soon enough wink just wait a couple days.

regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Page 1 of 2 1 2

Moderated by  old_bill, Tobias 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1