Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, monk12, TipmyPip, Quad, aliswee), 1,029 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
concave dynamic phys object #459096
04/22/16 04:16
04/22/16 04:16
Joined: Apr 2008
Posts: 15
Oz
T
tex Offline OP
Newbie
tex  Offline OP
Newbie
T

Joined: Apr 2008
Posts: 15
Oz
I am preparing a really simple driven car prac for my 3D students. I need to create a space for their character (babushka doll for now) to sit 'in' a little car's cabin (open at the top) - so that when the car collides with other objects in the scene the character gets flung out. I am proto-ing with some simple blocks for now. I can't use concave objects for dynamic phys interactions so i need to set up a collection of objects (for the sides of the cabin) acting as a single entity but with their own collision boxes. I've tried pXent_setgroup(entity, 2); but this seems to just instantiate a single bounding box over the group of objects. Now I am using pXent_addshape(); but it just seems to make the added shapes passable...

Is there a way to get the extra blocks to be individually collidable?

I am using 3DGS 8.45

here is a code snippet of whot I am using:

function main()
{
ENTITY* car = ent_create("base.mdl",vector(0,0,100),NULL);
pXent_settype(car,PH_RIGID,PH_BOX);

ENTITY* cabinFrontShape = ent_create("front.mdl",vector(0,0,0),NULL);
ENTITY* cabinBackShape = ent_create("back.mdl",vector(0,0,0),NULL);
pXent_addshape(car,cabinFrontShape,PH_BOX);
pXent_addshape(car,cabinBackShape,PH_BOX);

ENTITY* FLwheel = ent_create("wheelObj.mdl",vector(15,25,100),NULL);
ENTITY* FRwheel = ent_create("wheelObj.mdl",vector(15,-25,100),NULL);
ENTITY* RLwheel = ent_create("wheelObj.mdl",vector(-15,25,100),NULL);
ENTITY* RRwheel = ent_create("wheelObj.mdl",vector(-15,-25,100),NULL);

pXcon_add ( PH_WHEEL, FLwheel, car, 0 );
pXcon_add ( PH_WHEEL, FRwheel, car, 0 );
pXcon_add ( PH_WHEEL, RLwheel, car, 0 );
pXcon_add ( PH_WHEEL, RRwheel, car, 0 );

ENTITY* Dummy = ent_create("babushka02.mdl",vector(3,0,125),NULL);
pXent_settype ( Dummy, PH_RIGID, PH_BOX);

while(1)
{
var speed=0;
if(key_w)
{
speed+=1; // speed for car
}

pXcon_setwheel (FLwheel,0,0,0);
pXcon_setwheel (FRwheel,0,0,0);
pXcon_setwheel (RLwheel,0,speed,0);
pXcon_setwheel (RRwheel,0,speed,0);
pXent_addvelcentral(car,vector(speed,0,0)); // adds initial speed to body of car

Re: concave dynamic phys object [Re: tex] #459190
04/26/16 12:04
04/26/16 12:04
Joined: Apr 2008
Posts: 15
Oz
T
tex Offline OP
Newbie
tex  Offline OP
Newbie
T

Joined: Apr 2008
Posts: 15
Oz
I'm kind of surprised that this query didn't get answered. But after trawling through lots of posts it looks like it simply isn't possible in 3DGS. For others who may find the same query solution useful I will try to explain here:

Basically, use a PH_HINGE between the walls/panels that you want to use to create the concave shape (see figure 1). Set the swing angle for the hinge to -1/1 - so it can't move much. But you need to avoid internal collisions with other parts of the car body - so leave a gap between each entity. Then make the walls or panels INVISIBLE and use the addshape for the actual car body (see figure 2).



Re: concave dynamic phys object [Re: tex] #459196
04/26/16 13:40
04/26/16 13:40
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Dont know if it helps much, but you can use pXent_setcollisionflag and EVENT_FRICTION to set up an event function for collision of physics entities to other objects. Than you could manually write something where the if the car collides with something else, the drivers is throwed forwards through e.g. pXent_addforcecentral.

But my quess is also that the physics part of GS3d is outdated, so difficult to use for more complex situations like of this thread.

Last edited by Reconnoiter; 04/26/16 13:41.
Re: concave dynamic phys object [Re: Reconnoiter] #459200
04/26/16 14:09
04/26/16 14:09
Joined: Apr 2008
Posts: 15
Oz
T
tex Offline OP
Newbie
tex  Offline OP
Newbie
T

Joined: Apr 2008
Posts: 15
Oz
thanks Reconnoiter you beat me to it again...

I can see your idea for the pXent_setcollisionflag etc but having the doll flung out of the car is not the main purpose. Rather I was interested in a more authentic toycar with a driver exposed.

It is interesting that most car race sims I see just skip over this by making the driver fixed or the car is covered so you can't see the driver inside. I am doing something more super mario/toycar ish...

In fact its nearly finished - little toy car races around on a red and white table cloth trying to hit sugar cubes... includes dust trails...

Re: concave dynamic phys object [Re: tex] #459204
04/26/16 19:37
04/26/16 19:37
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Originally Posted By: tex
thanks Reconnoiter you beat me to it again...
tongue

Anyway, I thought you wanted to throw the driver out of the car on collision, cause this was in your first post ->
Quote:
- so that when the car collides with other objects in the scene the character gets flung out.


Or do you want to let the driver move a bit with his arms, torso and/or head etc.? Cause if you want the latter, just give the driver bones and animate it.

Cheers


Moderated by  HeelX, Spirit 

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