Gamestudio Links
Zorro Links
Newest Posts
Z9 getting Error 058
by k_ivan. 04/20/26 15:57
Stooq now requires an API key
by jcl. 04/13/26 09:42
Strange "Alien" Skull created with >Knubber<
by NeoDumont. 04/10/26 18:58
400 free seamless texture pack downl. here !
by NeoDumont. 04/08/26 19:55
ZorroGPT
by TipmyPip. 04/08/26 17:08
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (Grant), 3,476 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
juergenwue, VladMak, Geir, ondrej, mredit
19208 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
New to physics - question #133932
06/04/07 20:44
06/04/07 20:44
Joined: Oct 2005
Posts: 131
C
CBSection31 Offline OP
Member
CBSection31  Offline OP
Member
C

Joined: Oct 2005
Posts: 131
Hi everyone,

I'm trying to teach myself how to use the physics engine, but I'm having a little trouble. In my level, I have a can of paint hanging from a rope attached to the ceiling. See the picture below.



When the player walks into the paint can, I want the can to be movable, so it can realistically swing from the rope. Originally, I had it working perfectly. I used one model entity consiting of the bucket and rope. I created a hinge joint at the top of the entity (at the ceiling). It worked, and the entity rotated along the hinge as desired.

The problem was, it didn't look very realistic. So, I want to add a second hinge right at the top of the bucket, as you can see in the picture. Thus, when the player walks into the bucket, the bucket itself rotates along the bottom joint, but the rope also rotates along the top joint. Unfortunately, I have no clue how to set this up. I assume that I will need two seprate models: one for the bucket and one for the rope. I will also need two different joints.

But I'm not sure which kind of joint(s) to use, or how to set it up so that the bucket rotates AND the rope rotates. Would I use phcon_setmotor for this?

Any and all help is appreciated. Thanks!

Re: New to physics - question [Re: CBSection31] #133933
06/04/07 21:14
06/04/07 21:14
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
You should be able to just add another ball constraint to the bucket/rope point. Of course, you will need to seprate models for each though. You shouldn't have to use a motor or anything, collision should automatically move it...


xXxGuitar511
- Programmer
Re: New to physics - question [Re: xXxGuitar511] #133934
06/04/07 21:46
06/04/07 21:46
Joined: Oct 2005
Posts: 131
C
CBSection31 Offline OP
Member
CBSection31  Offline OP
Member
C

Joined: Oct 2005
Posts: 131
Thank you for your reply!

So let's say that I have two models: a rope model and a bucket model. I also have an invisible third model to use as the joint. I have this third model at the ceiling in the correct position. The rope and bucket models are also in position.

I should use a hinge joint to connect the rope to the invisible ceiling model, and then a ball joint to connect the rope to the bucket? Every time I create a ball joint, the bucket model just falls to the ground. Can one model have multiple joints?

Here's the code I'm using so far, which doesn't work:

Code:

entity* joint;
entity* joint2;
entity* rope;
entity* bucket;


action joint_high
{
joint2 = me;
}

action bucketrope
{
var ball_id;
rope = me;
wait (3);
phent_settype (my, ph_rigid, ph_box);
phent_setgroup (my, 2);
phent_setmass (my, 5, ph_box);
ball_id = phcon_add (ph_hinge, my, joint2);
phcon_setparams1 (ball_id, joint2.x, nullvector, nullvector);
phcon_setparams2 (ball_id, nullvector, nullvector, nullvector);
}


action joint_low
{
var ball_id;
joint = me;
wait (3);
phent_settype (my, ph_rigid, ph_box);
phent_setgroup (my, 2);
phent_setmass (my, 0, ph_box);
ball_id = phcon_add (ph_hinge, my, rope);
phcon_setparams1 (ball_id, rope.x, nullvector, nullvector);
phcon_setparams2 (ball_id, nullvector, nullvector, nullvector);
}


action act_bucket
{
bucket=me;
var ball_id;
wait (3);
phent_settype (my, ph_rigid, ph_box);
phent_setgroup (my, 2);
phent_setmass (my, 20, ph_box);
ball_id = phcon_add (ph_ball, my, joint);
phcon_setparams1 (joint, nullvector, nullvector, nullvector);
}



Last edited by CBSection31; 06/05/07 03:02.
Re: New to physics - question [Re: CBSection31] #133935
06/05/07 00:43
06/05/07 00:43
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Sorry, I'm no expert with 3DGS physics, I've mainly used Newton.

Ok, I found it... Your parameters for the constraints are wrong.

- The ph_ball constraint's first parameter needs to be the anchor point (where to rotate around).
- The ph_hinge constraints first parameter works the same as above.


xXxGuitar511
- Programmer
Re: New to physics - question [Re: xXxGuitar511] #133936
06/05/07 03:01
06/05/07 03:01
Joined: Oct 2005
Posts: 131
C
CBSection31 Offline OP
Member
CBSection31  Offline OP
Member
C

Joined: Oct 2005
Posts: 131
I fixed the parameters, but it still isn't working. The problem I'm having is, the bucket itself swings at the lower joint, but the rope doesn't move at all. The joint itself is higher than the player's head, so the player model never intersects with the joint. Could this be the problem?

What I need to happen is for the rope to start swinging if the bucket's rotation becomes too extreme.

Thanks again.

Last edited by CBSection31; 06/05/07 03:41.

Moderated by  HeelX, Spirit 

Gamestudio download | 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