Using EarlyOutPolyList and gServerContainer.buildPolyList()
by Joshua Jewell · in Torque Game Engine · 11/30/2006 (10:51 pm) · 4 replies
What I want to do is create 6 planes that form a box. I then want to use this box to see if there are any PlayerObjectType's inside of it. I tried using an EarlyOutPolyList because I only want to know when an object is inside my box not how many are inside, etc. The code looks like this:
bool obstructed = gServerContainer.buildPolyList(B, mask, &polyList);
B is a box that I constructed which is much larger then the area covered by the polyList formed box. What this code does is return true if there is a PlayerObjectType inside the area described by the box B. I do not see where my EarlyOutPolyList comes into play. When I create an EarlyOutPolyList with no planes it does not seem to make a difference.
If anyone could give me any insight into how I can check the area described by my collection of planes I would appreciate it. Using Box3F would be fine, but from what I have seen you can not rotate it along the x and y axis.
bool obstructed = gServerContainer.buildPolyList(B, mask, &polyList);
B is a box that I constructed which is much larger then the area covered by the polyList formed box. What this code does is return true if there is a PlayerObjectType inside the area described by the box B. I do not see where my EarlyOutPolyList comes into play. When I create an EarlyOutPolyList with no planes it does not seem to make a difference.
If anyone could give me any insight into how I can check the area described by my collection of planes I would appreciate it. Using Box3F would be fine, but from what I have seen you can not rotate it along the x and y axis.
#2
12/01/2006 (3:14 am)
The Player class has an implementation using EarlyOutPolyList that you should take a look at if you have not already. However, I would not use EAPL for something like that, though. I suggest you consider CPL since it is easier to use. EAPL relies on you passing it a vector of movement and then it culls faces that are not in that direction, and there are also other issues with it if you want real accurate collisions.
#3
Hey Stefan by CPL did you mean ConcretePoly or ClippedPoly? I think my problem lies in my confusion with the call to:
gServerContainer.buildPolyList(B, mask, &polyList)
So far every polyList I have feed into the function call yields the same result. I get the same result even if I throw an empty polyList into it. It returns true if an object of type mask is inside the area described by the Box3F B.
I guess my main problem is I do not see what role the polyList is playing. I have read the collision tutorials numerous times as well as looked at a lot of example. If anyone can clear up exactly how the buildPolyList() function works I would greatly appreciate it. As far as I can tell it returns true if an object is inside the area of the Box3F
12/01/2006 (12:48 pm)
Hey Sam thanks for the link to the Geometry class, it will be useful in the future. My problem is not how to rotate a box mathematically. My problem is that when you construct a box you only have two input 2 Point3F values. This does not allow the box to be rotated along the z-axis. If the collision I want to check is rotated a bit then the collision will be off.Hey Stefan by CPL did you mean ConcretePoly or ClippedPoly? I think my problem lies in my confusion with the call to:
gServerContainer.buildPolyList(B, mask, &polyList)
So far every polyList I have feed into the function call yields the same result. I get the same result even if I throw an empty polyList into it. It returns true if an object of type mask is inside the area described by the Box3F B.
I guess my main problem is I do not see what role the polyList is playing. I have read the collision tutorials numerous times as well as looked at a lot of example. If anyone can clear up exactly how the buildPolyList() function works I would greatly appreciate it. As far as I can tell it returns true if an object is inside the area of the Box3F
#4
I could try explaining what a poly list is but chances are I will confuse you more. There are no good articles either :/ I just see it as a place where you store poly's (but not collisions) and in that case ExtrudedPolyList removes some of the polies based on the velocity of the parent, which is an optimization not everyone will want.
12/01/2006 (1:38 pm)
ClippedPolyList. You can not instantiate ConcretePolyList, consider it as a base of which the other polylists are based on.I could try explaining what a poly list is but chances are I will confuse you more. There are no good articles either :/ I just see it as a place where you store poly's (but not collisions) and in that case ExtrudedPolyList removes some of the polies based on the velocity of the parent, which is an optimization not everyone will want.
Torque Owner Sam Redfern
edit: I found this page useful as a basis for some 2D geometry functions that I needed:
http://geosoft.no/software/geometry/Geometry.java.html