This project is read-only.

Testing Collision of Entities against a Frustum

Oct 5, 2012 at 5:42 AM

I am trying to use QS to create an RTS, and so I am starting with trying to select multiple entities. I was able to render a rectangle to the screen. Now, I want to be able to create a boundingfrustum object and test for entity collisions within that object.

So, my questions are:

Can i create a frustum and add a custom collision component to it (because its an irregular shape)?

and once done, how do i register the collision with all of the entities? If the object collides with multiple entities, will it register all of them in the Collision message, or will those entities register it?

 

I apologize if some of these are trivial, as I am just starting with this engine.

Thank you for your help

Oct 6, 2012 at 8:38 PM
I don't believe JigLibX (the Physics engine QuickStart uses) sees a BoundingFrustum as a primitive shape, so you would need to load a TriangleMeshShape and pass it the 12 triangles made up by the frustum. For an example of using this type of shape, the demo has a red space ship that uses that type. You'll want to use a PhantomPhysicsComponent, which I believe automatically listens for collisions so you would know what was within the frustum by listening for collisions. I believe there may also be a method in PhantomPhysicsComponent that you can call to ask for all collisions it currently has. It's been awhile since I integrated JigLibX and I'm not sure if a phantom shape supports TriangleMeshShapes.

Something else to be aware of, I don't believe JigLibX supports moving of a TriangleMeshShape, or if they do it might hurt performance, so if you're moving this frustum it could be an issue. If it doesn't work out you might have to use XNA's built-in BoundingFrustum against BoundingSphere checks.

- Nic

On Oct 4, 2012, at 10:42 PM, "Dnagreen" <notifications@codeplex.com> wrote:

From: Dnagreen

I am trying to use QS to create an RTS, and so I am starting with trying to select multiple entities. I was able to render a rectangle to the screen. Now, I want to be able to create a boundingfrustum object and test for entity collisions within that object.

So, my questions are:

Can i create a frustum and add a custom collision component to it (because its an irregular shape)?

and once done, how do i register the collision with all of the entities? If the object collides with multiple entities, will it register all of them in the Collision message, or will those entities register it?

I apologize if some of these are trivial, as I am just starting with this engine.

Thank you for your help

Oct 6, 2012 at 8:43 PM
Oh, also, every pair of new collisions will send out a collision message to each entity in the pair, and when the collision ends between that pair they will both receive an Offcollision message for that.

On Oct 4, 2012, at 10:42 PM, "Dnagreen" <notifications@codeplex.com> wrote:

From: Dnagreen

I am trying to use QS to create an RTS, and so I am starting with trying to select multiple entities. I was able to render a rectangle to the screen. Now, I want to be able to create a boundingfrustum object and test for entity collisions within that object.

So, my questions are:

Can i create a frustum and add a custom collision component to it (because its an irregular shape)?

and once done, how do i register the collision with all of the entities? If the object collides with multiple entities, will it register all of them in the Collision message, or will those entities register it?

I apologize if some of these are trivial, as I am just starting with this engine.

Thank you for your help