Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,649 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Non - physics to physics object collisions #265345
05/12/09 08:00
05/12/09 08:00
Joined: Oct 2007
Posts: 116
S
sydan Offline OP
Member
sydan  Offline OP
Member
S

Joined: Oct 2007
Posts: 116
I have a player who can run around a room. In the room there are small physics objects on the floor. The player needs to push these out the way. Its all ok at the moment (except for the fact that ph_cylinder and ph_poly dont really work) but the physics objects dont move away properly. If they are effected by the player they usually fly of at great speeds (explode). How can I make the objects be displaced by the player reliably?


For some reason, my ambition always seems to beat my ability.
Re: Non - physics to physics object collisions [Re: sydan] #265360
05/12/09 10:05
05/12/09 10:05
Joined: May 2003
Posts: 567
Spain, Canary Islands
Felixsg Offline
User
Felixsg  Offline
User

Joined: May 2003
Posts: 567
Spain, Canary Islands
the ph_poly is only for static objects
if you put in your player model probably that is the problem
can you put a invicible physics sphere in the knee of
the model player

Re: Non - physics to physics object collisions [Re: Felixsg] #265365
05/12/09 10:37
05/12/09 10:37
Joined: May 2009
Posts: 1,816
at my pc (duh)
darkinferno Offline
Serious User
darkinferno  Offline
Serious User

Joined: May 2009
Posts: 1,816
at my pc (duh)
well sydan, there r a few ways... but lemme explain whats happening now, ur physics object do react to the non-physics object but not correctly, i think the only reason y they even move is because the physics engine is trying to remove all physics object from any model that they maybe colliding with.. am not a 100 percent sure if am right so far but some1 will correct me if i'm wrong

about solving the problem:
1-let the player passable to all physics objects and apply a force to the physics objects via c_scan for example
2-make the player a physics object, this can be done with the in-engine physics but as a few side effects

but overall, never use ph_poly or ph_cylinder for non-static elements

Re: Non - physics to physics object collisions [Re: darkinferno] #265395
05/12/09 12:50
05/12/09 12:50
Joined: Oct 2007
Posts: 116
S
sydan Offline OP
Member
sydan  Offline OP
Member
S

Joined: Oct 2007
Posts: 116
Hey. Thanks for the help so far. Ok, i won't attempt to use ph_poly but it is almost essential that I use ph_cylinder as the objects are small canisters that will look silly if they don't act how they look.

I have considered making the player passable to physics. If I were to use a c_scan, however, would this not lower the frame rate?

What side effects are there of making the player a physics object? I know movement will be quite different.

I did think of attaching a physics object to the player, but how effective would this be?


For some reason, my ambition always seems to beat my ability.
Re: Non - physics to physics object collisions [Re: sydan] #265402
05/12/09 13:10
05/12/09 13:10
Joined: May 2009
Posts: 1,816
at my pc (duh)
darkinferno Offline
Serious User
darkinferno  Offline
Serious User

Joined: May 2009
Posts: 1,816
at my pc (duh)
Originally Posted By: sydan
I have considered making the player passable to physics. If I were to use a c_scan, however, would this not lower the frame rate?

as long as its range isnt too high... my player is constantly c_scanning per frame, my explosions c_scan plus all enemies and weapons c_trace and if u play with it right, it wont affect ur overall framerate

Originally Posted By: sydan
What side effects are there of making the player a physics object? I know movement will be quite different.

the side effects with the physics player i'm using is minor unstability on terrains and the player slowly slides when on sloped surfaces...

Originally Posted By: sydan
I did think of attaching a physics object to the player, but how effective would this be?

i've heard of this, havent tried it, but theoretically, it sounds possible... u would have to make the player passable then set the phys object to his position each frame

wink

dark out...

Re: Non - physics to physics object collisions [Re: darkinferno] #265414
05/12/09 13:41
05/12/09 13:41
Joined: Oct 2007
Posts: 116
S
sydan Offline OP
Member
sydan  Offline OP
Member
S

Joined: Oct 2007
Posts: 116
Hey Darkinferno! Thanks for the reply! I was wondering where you said:
Originally Posted By: darkinferno
the side effects with the physics player i'm using is minor unstability on terrains and the player slowly slides when on sloped surfaces...

How have you actually set the player as a physics object? How does that sort of code work? Do you control movement through physics functions? And are there any other restrictions?


For some reason, my ambition always seems to beat my ability.
Re: Non - physics to physics object collisions [Re: sydan] #265420
05/12/09 14:11
05/12/09 14:11
Joined: May 2009
Posts: 1,816
at my pc (duh)
darkinferno Offline
Serious User
darkinferno  Offline
Serious User

Joined: May 2009
Posts: 1,816
at my pc (duh)
Originally Posted By: sydan
Hey Darkinferno! Thanks for the reply! I was wondering where you said:
Originally Posted By: darkinferno
the side effects with the physics player i'm using is minor unstability on terrains and the player slowly slides when on sloped surfaces...

How have you actually set the player as a physics object? How does that sort of code work? Do you control movement through physics functions? And are there any other restrictions?


its rather simple really... basically you just need some code to stabilize the entity so it doesnt fall over, this however causes the model to move when on sloped surfaces and there are some errors that happens a few times such as falling thru the floor but by setting the correct global physics variables, that will be non-existent, i thinks its because, its TRYING to fall over but the code is stopping it.. FRICTION NO LONGER works, i'm trying to solve this

anyways... run the following in a while loop after setting up ur physics entity the normal way

if(mouse_force.x > 0)
{
phent_enable(my, 0); //disables the entity temporarily
my.pan = camera.pan; //sets it to camera pan
my.tilt = 0; //stops it from tilting over
my.roll = 0; //ditto laugh
phent_enable(my, 1); // reenables entity
}

if(key_w == 1 ) // move forward
{
phent_enable(my, 0); //disable
my.pan = camera.pan;//adjust pan
my.tilt = 0;
my.roll = 0;
phent_enable(my, 1);//enable
phent_addvellocal(my,vector(50,0,0),nullvector);
}

//the following runs every frame to stop the model from turning over, it is //recommended that this is last in the while loop

if (my.tilt!=0)
{
phent_enable(my, 0);
my.tilt = 0;
my.roll = 0;
}
if (my.roll!=0)
{
phent_enable(my, 0);
my.tilt = 0;
my.roll = 0;
}

that is the basic idea, am afraid thats all the code i can give tho, partners wont be particularly happy laugh.. but hey, we all needed help once, i think ppl should think like that.. you can also see this in action by checking the video on my thread(in signature) all characters shown there are physics object..

once again, sorry for not using code tags, ant it'll continue until i see where the code tag icon is.. or maybe some1 could tell me laugh


Last edited by darkinferno; 05/12/09 14:13.
Re: Non - physics to physics object collisions [Re: darkinferno] #265432
05/12/09 14:43
05/12/09 14:43
Joined: Oct 2007
Posts: 116
S
sydan Offline OP
Member
sydan  Offline OP
Member
S

Joined: Oct 2007
Posts: 116
Thank you for the code! Very helpful. Now all I have to do is decide which method to use and get testing.

One final thing about ph_cylinder. Im running this:

phent_settype(me, ph_rigid, ph_box)
phent_mass(me, ... , ph_cylinder)

This works, I think but I'm not sure why. And why makew two physics settings only for static objects???


For some reason, my ambition always seems to beat my ability.

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