Information on sweeptests?

Hi,

I’m looking for some information on sweeptests, I understand that they are a sort of ray test but with a collisionshape… What I don’t get is wat the Transform start and Transform end parameters represent…

What i’m trying to achieve is having an object check what other objects are around it (not just in front of it) can someone tell me how this is done with a sweepTest or point me towards some information concerning this? (i’ve googled and checked the forrums too, but did not find muchhelpful stuff there…)

Thanks in advance

Theres a test here:
https://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/bullet/TestSweepTest.java

A transform contains translation/rotation/scale. The shape starts at 1 transform and sweeps to the other transform, and returns the objects it would collide with. Keep a note of these limitations tho (taken from the javadoc):

Performs a sweep collision test and returns the results as a list of PhysicsSweepTestResults You have to use different Transforms for start and end (at least distance > 0.4f). SweepTest will not see a collision if it starts INSIDE an object and is moving AWAY from its center.
1 Like

For example, imagine you have a bullet. You want to know if it’s intercepted somewhere between the weapon and the target. Sweeptest should do just that. You specify the starting “pose”’ and the end “pose”, and it checks if it collides something inbetween.

Okay, so if I would want to do the following sweep:

then the following code should do the trick right?

[java]Transform start = new Transform(character.getPhysicsLocation());
start.setScale(1);
Transform end = new Transform(character.getPhysicsLocation());
end.setScale(50);

CollisionShape sweepShape = new CylinderCollisionShape(new Vector3f(2,2,2),1);

app.getStateManager().getState(BulletAppState.class).getPhysicsSpace().sweepTest(sweepShape,start,end, sweepResult);[/java]

but it’s not working! list remains empty… what am i missing?