1 registered members (AndrewAMD),
1,089
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
[SOLVED] POLYGON flag with weird results
#416706
02/03/13 17:57
02/03/13 17:57
|
Joined: Jan 2013
Posts: 63
Loremaster
OP
Junior Member
|
OP
Junior Member
Joined: Jan 2013
Posts: 63
|
A lazy Sunday to ye all, And the next question. For certain parts I'd like to have polygonal collision detection. I assign to certain models the following 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:
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
Expert
|
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
OP
Junior Member
|
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
Expert
|
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
OP
Junior Member
|
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... 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. 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
Expert
|
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: Superku]
#416718
02/03/13 19:37
02/03/13 19:37
|
Joined: Jan 2013
Posts: 63
Loremaster
OP
Junior Member
|
OP
Junior Member
Joined: Jan 2013
Posts: 63
|
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... 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
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
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.htmWhen 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! 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
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
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
|
|
|
|