I'm making an RTS game and its coming along really well and now I'm up to getting units to fight each other but I'm thinking once its all up and running ill need a way for the units to only crunch numbers for units that are in range.
I have setup a grid of DetectorVolume's and I was hoping to use the events to add and remove units from the grid nodes I have setup but the events are not firing. I know the Volumes are there because I can shoot my mouse ray at them and get some feed back that I have indeed hit a grid node but the events never fire.
My units are setup as CharacterController's and I will be moving the simpler units over to SphereCharacterController at some point later but for now the CharacterController gives me really nice perf(1.2ms) so far with 48 of them all driving around harvesting and building.
My question is what have I don't wrong with the DetectorVolume.
Code: Select all
Public Class PhysicsGridNode Inherits DetectorVolume Public GridIndex As Index Public bounds As BoundingBox Public Sub New(shape As BoundingBox, BoxGeometry As Geometry(Of Vector3), _GridIndex As Index, world As AffineTransform) MyBase.New(New TriangleMesh(New BEPUphysics.DataStructures.TransformableMeshData(BoxGeometry.VertexList.ToArray, BoxGeometry.IndexList.ToArray, world))) bounds = shape GridIndex = _GridIndex AddHandler EntityBeganTouching, AddressOf BeganTouching AddHandler EntityStoppedTouching, AddressOf StoppedTouching AddHandler VolumeBeganContainingEntity, AddressOf BeganContaining AddHandler VolumeStoppedContainingEntity, AddressOf StoppedContaining End Sub Private Sub StoppedContaining(volume As DetectorVolume, entity As Entity) End Sub Private Sub BeganContaining(volume As DetectorVolume, entity As Entity) End Sub Private Sub StoppedTouching(volume As DetectorVolume, toucher As Entity) End Sub Private Sub BeganTouching(volume As DetectorVolume, toucher As Entity) End Sub End Class