Moving DetectorVolume

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
pars3rror
Posts: 2
Joined: Mon Nov 17, 2014 2:42 am

Moving DetectorVolume

Post by pars3rror »

Hi guys!

I have a little question regarding detectorVolumes. Maybe s.o. can help me.

As the subject suggests, I want to move a detectorVolume around. Just like a cube. But I cannot set linearVelocity or Position or anything..

I tried to make it inherit from Entity but it went haywire when I tried to add it to the space, saying that something was null.

I think it would take me ages until I find a way.. maybe let it just implement ISimulationIslandMemberOwner? I don't know..
I just want to move it around.

I don't even care if it is a DetectorVolume. I just want to send and object across the space, fireing (custom) events when it touches other objects.

Is there any way?

Thanks in advance for your help!
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Moving DetectorVolume

Post by Norbo »

If simulated motion is desired, entities have collision events that you could use. Check out the collision events documentation for more information. The Getting Started documentation also shows a simple collision event.

The DetectorVolume is not an Entity, so it is not capable of simulated motion. You could teleport it by changing the relevant triangle mesh data and calling DetectorVolume.UpdateBoundingBox, but unless you really need the features of the DetectorVolume specifically, I would recommend using entities.
pars3rror
Posts: 2
Joined: Mon Nov 17, 2014 2:42 am

Re: Moving DetectorVolume

Post by pars3rror »

oh right!
how could I miss that..

Thanks! works like a charm.



[in case any 1 ever needs a quick code sample:]

Entity testEntity;
testEntity = new Box(new Vector3(0, 0, 0), 1, 1, 1);
testEntity.CollisionInformation.Events.PairCreated += PairCreated;

private void PairCreated(EntityCollidable collidable, BroadPhaseEntry bpEntry, NarrowPhasePair npPair)
{
// fun stuff
}
Post Reply