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
0 registered members (), 16,232 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
Page 1 of 2 1 2
Stacking boxes .... #48080
06/18/05 15:17
06/18/05 15:17
Joined: Sep 2001
Posts: 375
Hamburg, Germany / Springfield...
Andreas C Offline OP
Senior Member
Andreas C  Offline OP
Senior Member

Joined: Sep 2001
Posts: 375
Hamburg, Germany / Springfield...

I am (finally) getting around to firing up 3DGS and getting into some physics.

I have created 12 boxes, assigned the following physics attributes :

phent_settype(Me,PH_RIGID,PH_BOX);
Phent_setmass(Me,0.5,PH_BOX);
phent_setdamping(Me,15,15);
phent_setelasticity(Me,15,1);
ph_setgravity(earthgrav);
ph_setautodisable(0.01,0.1,10,0.1);
ph_selectgroup(1);

(earthgrav is defined as [0,0,-389])

Some of the boxes are stacked (in WED) and when the ph_selectgroup(1) takes effect, they just "tumble" into each other instead of staying put .

I changed the ph_setautodisable values because it always seems like one of the boxes just kept spinning around its own vertical axis.

I've also tried to change the model in MED (moving it so that the origin is dead center). I have searched the forum, but have not found anything so far.

Any tip where I could find some stuff on this would be appreciated !

Cheers,
Andreas


____________________________________________________
GameCore / Unity / UDK
Lightwave 9.6 / Blender / Fragmotion / ZBrush 3.5
TextureMaker / PSP-X
Re: Stacking boxes .... [Re: Andreas C] #48081
06/19/05 17:50
06/19/05 17:50
Joined: Sep 2001
Posts: 375
Hamburg, Germany / Springfield...
Andreas C Offline OP
Senior Member
Andreas C  Offline OP
Senior Member

Joined: Sep 2001
Posts: 375
Hamburg, Germany / Springfield...
I've captures some images from the room I am "playing" in.

Right now, I see the following "problems" :

a.) the boxes do not remain stacked when physics become enabled
b.) the color of (some) of the boxes change without reason. They are all the same model, with the same action attached.

Especially the second one got me spooked. I am willing to accept that I have not yet mastered the physics engine, but I was pretty sure that models wouldn't change colors without any reason.


I'm using WINXP / 3DGSPro (6.31.4), NVidia GeForce4 Ti 4200 (128MB RAM) with the latest drivers, DirectX 9c is installed.

Here's the first pic - the physics engine has not yet been enabled (I put a 5 second SLEEP in in order to take a closer look at the level before physics start doing its stuff). All boxes look normal, some are stacked, some are "suspended in mid-air" until physics are enabled.



Next, when the PHYSICS engine is enabled, the color of some of the boxes change :


I also notice that the boxes do not stay stacked:



And some of the boxes even keep spinning around their own vertical axis at high speed, without any apparent "trigger":



Very strange ... anyone with any tips ?

Thanks,
Andreas


____________________________________________________
GameCore / Unity / UDK
Lightwave 9.6 / Blender / Fragmotion / ZBrush 3.5
TextureMaker / PSP-X
Re: Stacking boxes .... [Re: Andreas C] #48082
06/19/05 18:43
06/19/05 18:43
Joined: Aug 2003
Posts: 275
Germany
kopitzki Offline
Member
kopitzki  Offline
Member

Joined: Aug 2003
Posts: 275
Germany
Try

var boxgroup=2;

ACTION boxes
{
//other stuff
phent_setgroup (my, boxgroup;
boxgroup+=1;
//other stuff
}

This could help because objects of one and the same group showed up collision problems with my code once. Also I guess your boxes need to be put at least at some distance. And I remember that there aren't any problems of this type with the NEWTON ph-engine.

Re: Stacking boxes .... [Re: kopitzki] #48083
06/19/05 21:24
06/19/05 21:24
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
Regarding your physics, I don't see you setting the friction at all with phent_setfriction(). This is very important for a stack.

Regarding your stack, how close are you stacking? I've found great success at stacking boxes by having them be a few quants off of each other and let them fall into position. If I try to stack boxes by having the faces touch or leaving just 1 quant of space, I get these issues. I also find that a higher than normal gravity helps too...try around -700.

Regarding the color change, I've never seen anything like that in all my time with the PE. Don't know what's going on there.

Re: Stacking boxes .... [Re: fastlane69] #48084
06/20/05 18:38
06/20/05 18:38
Joined: Sep 2001
Posts: 375
Hamburg, Germany / Springfield...
Andreas C Offline OP
Senior Member
Andreas C  Offline OP
Senior Member

Joined: Sep 2001
Posts: 375
Hamburg, Germany / Springfield...
fastlane69,

thanks for the tip ... I had already added a phent_setfriction, but could not really see much of a difference.

I was going to experiment with some of the values, but my C-script file just got screwed up, so right now I can't run anything.

Kopitzki,
you are correct, NEWTON handles stacked boxes without any apparent problem. But setting it up is a bit more involved ...

Cheers,
Andreas


____________________________________________________
GameCore / Unity / UDK
Lightwave 9.6 / Blender / Fragmotion / ZBrush 3.5
TextureMaker / PSP-X
Re: Stacking boxes .... [Re: Andreas C] #48085
06/24/05 18:21
06/24/05 18:21
Joined: Apr 2002
Posts: 1,867
N
Neuro Offline
Serious User
Neuro  Offline
Serious User
N

Joined: Apr 2002
Posts: 1,867
Quote:

But setting it up is a bit more involved ...




Yah, I use to think that too. Heres some pointers: remember...wait(2) frames after loading the level, and scan_entity after moving your entity (in order to affect any physical objects).


The Wii Effect - a look at Nintendo's epidemic
[NEWTON] Re: Stacking boxes .... [Re: Neuro] #48086
06/24/05 19:39
06/24/05 19:39
Joined: Sep 2001
Posts: 375
Hamburg, Germany / Springfield...
Andreas C Offline OP
Senior Member
Andreas C  Offline OP
Senior Member

Joined: Sep 2001
Posts: 375
Hamburg, Germany / Springfield...
Quote:

Quote:

But setting it up is a bit more involved ...




Yah, I use to think that too. Heres some pointers: remember...wait(2) frames after loading the level, and scan_entity after moving your entity (in order to affect any physical objects).




@Neuro,

I had no problems setting NEWTON up, but my player just "runs into / onto" the physics objects. If I understand correctly, scan_entity will cure that ?

Does this mean that I have to add a scan_entity to my player and have the physics object "react" to a SCAN event ? If that's correct, then I guess just using the A6 biped template "as is" won't work ... (right now I want to test physics, not develop my own player movement script )

The A6 physics engine is still giving me gray hairs. I've fiddled around with the settings with mixed success. My barrels I can stack - but the boxes still keep jumping around wildly . Also, I have had good "success" pushing boxes through walls (into nirvana) - on occasion, my player has followed - giving me an unusual view of the outside of my single room level

If I had to venture a guess, I'd say that it could be that my walls are too big (the room was created out of a large cube that was hollowed) because each face consists of a single polygon ... can anyone confirm this hunch ?

Cheers,
Andreas


____________________________________________________
GameCore / Unity / UDK
Lightwave 9.6 / Blender / Fragmotion / ZBrush 3.5
TextureMaker / PSP-X
[NEWTON] Re: Stacking boxes .... [Re: Andreas C] #48087
06/25/05 03:08
06/25/05 03:08
Joined: Apr 2002
Posts: 1,867
N
Neuro Offline
Serious User
Neuro  Offline
Serious User
N

Joined: Apr 2002
Posts: 1,867
If you're running the A6 built in physics, then everything should react automatically after inital setup. I have the commercial version so i could only test 1 object, but it did react as it should when force is applied to it(by shooting at it or by walking into it). Of course, I never actually stacked a group of AI physic boxes so I dont know how they would react to each other.

Quote:

Does this mean that I have to add a scan_entity to my player and have the physics object "react" to a SCAN event ? If that's correct, then I guess just using the A6 biped template "as is" won't work ... (right now I want to test physics, not develop my own player movement script )




Thats the interesting thing about the NEWTON plugin. Theres documentation and examples for it, but nothing explains how to do it manully. I recall agent_smith made a nice tutorial about it a while back, but still didn't explain everything (i'm no newton expert either ).

So I decided to create "fake" physics of my own for my objects which reacted to being pushed or shot at, but the gravity didn't quite work so well. So I took another look at newton...

Newtons physic objects will only react when hit by a scan_entity. In the <newtonScript2.wdl>, theres an event function called "NewtonGSScriptEvent" that does the applying of force. There's a block of code in it that looks sorta like :
Code:

newtonImpulseRecord[0] = target[0];
newtonImpulseRecord[1] = target[1];
newtonImpulseRecord[2] = target[2];

// copy origin of bullet (use to determone the direction of the impulse)
newtonImpulseRecord[3] = you.x;
newtonImpulseRecord[4] = you.y;
newtonImpulseRecord[5] = you.z;

// copy the bullet mass
newtonImpulseRecord[6] = you.skill4;

// copy the bullet speed
newtonImpulseRecord[7] = you.skill5;
NewtonBodyAddImpulse (body, newtonImpulseRecord);



You're gonna have to make a custom event function...but anyways....
In newtonImpulseRecord[7] is where it's critical to detect whats hitting it. If the speed of the bullet (or who or whatever hits the object) is too high, it just may go right through the object. By lowering it (and setting different parameters based on your code), I was able to affect the physic object differently by walking into it(pushing) or shooting at it or even having other entities walk into it. Matter of fact, I even did the box stacking thing and had all the AI entities walk into it knocking it over.

Quote:

If I had to venture a guess, I'd say that it could be that my walls are too big (the room was created out of a large cube that was hollowed) because each face consists of a single polygon ... can anyone confirm this hunch ?




Nah, I dont think thats the problem. Cause I do all my tests on large hollowed cubes....but I'm not sure about faces consisting of single polygons.


The Wii Effect - a look at Nintendo's epidemic
[NEWTON] Re: Stacking boxes .... [Re: Neuro] #48088
06/27/05 14:35
06/27/05 14:35
Joined: Sep 2001
Posts: 375
Hamburg, Germany / Springfield...
Andreas C Offline OP
Senior Member
Andreas C  Offline OP
Senior Member

Joined: Sep 2001
Posts: 375
Hamburg, Germany / Springfield...
@Neuro,
thanks for the help !

I looked at the code and it seems to also account for other EVENTS (beyond SCAN). I successfully got my player (using the A6-template) to interact, but since it only uses the IMPACT event, the bounding box problem shows up once the object has been "pushed over". I'll play around with adding a SCAN_ENTITY functionality next weekend - should result in even better "collisions" .

Cheers,
Andreas


____________________________________________________
GameCore / Unity / UDK
Lightwave 9.6 / Blender / Fragmotion / ZBrush 3.5
TextureMaker / PSP-X
[NEWTON] Re: Stacking boxes .... [Re: Andreas C] #48089
06/27/05 21:08
06/27/05 21:08
Joined: Apr 2002
Posts: 1,867
N
Neuro Offline
Serious User
Neuro  Offline
Serious User
N

Joined: Apr 2002
Posts: 1,867
Good luck....I had my fun of physics for the week...I'm going back to working with AI...since thats the hot topic of the month...


The Wii Effect - a look at Nintendo's epidemic
Page 1 of 2 1 2

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