Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,089 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
[SOLVED] POLYGON flag with weird results #416706
02/03/13 17:57
02/03/13 17:57
Joined: Jan 2013
Posts: 63
Loremaster Offline OP
Junior Member
Loremaster  Offline OP
Junior Member

Joined: Jan 2013
Posts: 63
A lazy Sunday to ye all,

And the next question. blush For certain parts I'd like to have polygonal collision detection. I assign to certain models the following code:

Code:
action BBPolyPrecise () {
	my.flags |=POLYGON;
}



The results are strange. Basically all three models show the BB assigned by the engine, two of which are totally useless. I also noted, that in MED the center of the correctly hulled model is sitting differently from the centers of the incorrect models (all illustrated in the pic in the Spoiler.)

I know, I can use code like that:

Code:
action BBRail01short () {
	c_setminmax(my);
	wait(1);
	vec_set(my.min_x,vector(-22,-5,-20)); 
	vec_set(my.max_x,vector(22,5,30));
}



But a) I want the polygonal detection and b) it is very odd and I should be able to address it. What's wrong with our models? (We use 3DS Max 5.1 for modelling and export / import via FBX).



EDIT/ Problem solved thanks to Superku and Uhrwerk, see last post.

Last edited by Loremaster; 02/03/13 22:24.
Re: POLYGON flag with weird results [Re: Loremaster] #416708
02/03/13 18:23
02/03/13 18:23
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
When you press F11 twice you'll always see the bounding box. Seeing a bounding box does not mean that the entity does not have the POLYGON flag set. So you cannot jump to conclusion from that. Are you experiencing trouble with the collision detection?

Your action BBRail01short is most likely not doing what you expect it to do. Letting the engine automatically determine the hull of an entity and then overwriting these values by hand seems not useful to me.

I'd also recommend setting the entities center always inside it's bounds, mostly centered.


Always learn from history, to be sure you make the same mistakes again...
Re: POLYGON flag with weird results [Re: Loremaster] #416709
02/03/13 18:24
02/03/13 18:24
Joined: Jan 2013
Posts: 63
Loremaster Offline OP
Junior Member
Loremaster  Offline OP
Junior Member

Joined: Jan 2013
Posts: 63
Solved the problem myself, i.e. wasn't one. The ColDet works, though the BB is shown incorrectly not as I would have expected.

Sorry for bothering you.

Last edited by Loremaster; 02/03/13 18:25.
Re: POLYGON flag with weird results [Re: Loremaster] #416710
02/03/13 18:25
02/03/13 18:25
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
If the bounding box is shown incorrectly this is a bug and should be reported. But how do you get the idea it is shown incorrectly?


Always learn from history, to be sure you make the same mistakes again...
Re: POLYGON flag with weird results [Re: Loremaster] #416713
02/03/13 18:32
02/03/13 18:32
Joined: Jan 2013
Posts: 63
Loremaster Offline OP
Junior Member
Loremaster  Offline OP
Junior Member

Joined: Jan 2013
Posts: 63
Upps, seconds to late. Thanks for your trouble. I, too, would assume, centering the centre kind of seems logical. Don't know what the modeller thought by off-centering the headpiece...

Quote:
Your action BBRail01short is most likely not doing what you expect it to do. Letting the engine automatically determine the hull of an entity and then overwriting these values by hand seems not useful to me.


Well, I meant setting min und max as a workaround of POLYGONAL fails, not as an addition to it.

Originally Posted By: Uhrwerk
If the bounding box is shown incorrectly this is a bug and should be reported. But how do you get the idea it is shown incorrectly?


Not sure if it's a bug, since I don't know the exact workings of the engine yet. But check the pic in the OP. The BBs are plainly off in size. POLYGON was set. Would you say it's a bug? I can't decide and don't want to bother the devs with dumb stuff of mine.

And although these weird boxes show up, the ColDet works polygonal.

As always - thanks for quick and useful replies.

Re: POLYGON flag with weird results [Re: Loremaster] #416716
02/03/13 18:49
02/03/13 18:49
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
You're mixing up two concepts. An entity always has a bounding box - regardless of the POLYGON flag. This bounding box is determined by the min_x ... max_z members. The POLYGON flag just tells the engine to ignore the bounding box when doing collision detection, but does not remove it. Setting d3d_lines to a value > 1 (This is exactly what happens when you press F11 twice) will draw the bounding box regardless of the polygon flag.

At a first glance you might think that this is irritating and senseless but you can use the bounding box for other purposes as well, e.g. to emit particles inside a predefined cube etc. Even entities with the PASSABLE flag set can use their bounding boxes.


Always learn from history, to be sure you make the same mistakes again...
Re: POLYGON flag with weird results [Re: Uhrwerk] #416717
02/03/13 19:05
02/03/13 19:05
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
As a little addition to Uhrwerk's words, in A7 (at least 3 years ago but I don't think this has changed) the collision detection on big models could fail with the POLYGON flag set with the small default bounding box. I once had a platform, sth like 768-1024 quants long (player height = 90 quants), where the player could fall through the right 3rd of the entity, until jcl explained to me that I would have to adjust the bounding box (i.e. call c_setminmax) of the entity too.
I assume the collision engine works like this that it grabs the non-passable entities from the/ a (ABT?) tree, checks for possible bounding box-box collisions with a little buffer and only then executes box-polygonal collision detection.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: POLYGON flag with weird results [Re: Superku] #416718
02/03/13 19:37
02/03/13 19:37
Joined: Jan 2013
Posts: 63
Loremaster Offline OP
Junior Member
Loremaster  Offline OP
Junior Member

Joined: Jan 2013
Posts: 63
Originally Posted By: Superku
I once had a platform, sth like 768-1024 quants long (player height = 90 quants), where the player could fall through the right 3rd of the entity, until jcl explained to me that I would have to adjust the bounding box (i.e. call c_setminmax) of the entity too.


So basically what I was trying to achieve with my workaround...

Originally Posted By: Uhrwerk
You're mixing up two concepts. An entity always has a bounding box - regardless of the POLYGON flag. This bounding box is determined by the min_x ... max_z members. The POLYGON flag just tells the engine to ignore the bounding box when doing collision detection, but does not remove it.


Aaah. Concept understood, thanks. All right, then just to learn: How does the engine compute th BB? Those in the pic (and others) are way off in their dimensions.

Last edited by Loremaster; 02/03/13 19:37.
Re: POLYGON flag with weird results [Re: Loremaster] #416719
02/03/13 19:44
02/03/13 19:44
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Originally Posted By: Loremaster
How does the engine compute th BB?

It does not compute them. There are default values for these. See the manual: http://www.conitec.net/beta/aentity-min_x.htm

When you call c_updatehull the engine iterates over all vertices and if they lay outside the current bounds the bounds are updated to include the current one. But that is just a guess!

Originally Posted By: Loremaster
Those in the pic (and others) are way off in their dimensions.
Did you call c_updatehull for them without writing to min_x ... max_z afterwards?


Always learn from history, to be sure you make the same mistakes again...
Re: POLYGON flag with weird results [Re: Uhrwerk] #416721
02/03/13 19:52
02/03/13 19:52
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Quote:
So basically what I was trying to achieve with my workaround...

You did understand that you have to use both commands, right? Like
set(my,POLYGON);
c_setminmax(my);

Btw. if you are using A6 I think you have to wait one frame before calling c_setminmax because otherwise the values get overwritten in the first frame after creation, i.e. change

c_setminmax(my);
wait(1);
vec_set(my.min_x,vector(-22,-5,-20));
...
to

wait(1);
c_setminmax(my);
vec_set(my.min_x,vector(-22,-5,-20));


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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