Nearby Objects
by Luigi Rosso · in Torque Game Engine · 04/30/2002 (10:25 pm) · 5 replies
I'm finishing off some work on melee weapons and I originally had them implemented for only players (collisions were only checked against other players) but now that I moved everything from hitboxes on over to ShapeBase I need to check a lot more possible items for every tick. So I'm using the working list used for collision detection (a list of possibile colliding objects nearby). Now this works fine on most melee weapons but not with longer ones (spears for example) because they extend further than the objects in the nearby list.
I have a number of options:
1) Keep my weapons short.
2) Fill a container.
3) Traverse the objects in the scene (which I think the container does anyway).
Which do you think would be most efficient? Are there other possibilities which I'm overlooking?
Thanks for the read,
Luigi
I have a number of options:
1) Keep my weapons short.
2) Fill a container.
3) Traverse the objects in the scene (which I think the container does anyway).
Which do you think would be most efficient? Are there other possibilities which I'm overlooking?
Thanks for the read,
Luigi
About the author
#2
05/01/2002 (2:27 am)
I'll give it a go thanks but I think that what I'm doing now is doing more or less the same thing (with the bounds box) the problem is that the spear sticks out of the bounds box so I need to detect a little farther, best would be to detect from the spear's blade's start point but I'm not sure of what kind of a performance hit that would have (essentially I'd be 'filling' a container from there too...at that point I might as well traverse the whole scene for shapebase objects).
#3
I think that the working collision list is broader than the bounds box because I'd only detect objects when I'd actually run into them (when the bounds box would overlap) and they are very tightly packed to the shape.
05/01/2002 (3:39 am)
Ok I tried it out. I basically built a list on ShapeBase which keeps track of objects found within the player's bounds.I think that the working collision list is broader than the bounds box because I'd only detect objects when I'd actually run into them (when the bounds box would overlap) and they are very tightly packed to the shape.
#4
It let's you set the radius of the search.
05/01/2002 (6:09 am)
Luigi, what if you use a ContainerSearch, the one that is used to search objects for taking damage of explosions?It let's you set the radius of the search.
#5
The problem with that function is that I don't think it'd be the most efficient way to do it, I would prefer to do it with what's already in place (like the working collision list, as it's called) to generate the lowest performance hit possible (especially since players are going to have multiple weapons).
05/01/2002 (7:43 am)
Hi Xavier, thanks for the suggestion. That's what I meant with the fill container/container find objects. The radius search you speak of is script side, and essentially it evokes that method.The problem with that function is that I don't think it'd be the most efficient way to do it, I would prefer to do it with what's already in place (like the working collision list, as it's called) to generate the lowest performance hit possible (especially since players are going to have multiple weapons).
Torque Owner Badguy
consider viewing:
void ShapeBase::updateContainer()
as the mContainer that is updated here should have what you need.
it uses the bounds of itself to consider objects nearby