Projectiles not always colliding

Hello all,



I’m having an issue with my projectiles. They seem to be going through my level’s geometry when they’re going fast enough. They are in their own BulletAppState with the level geometry, and the level’s physics object is a mesh shape. I’ve been playing with parameters like physicsSpace.setAccuracy() and rigidBody.setCcdMotionThreshold(), with little success with either. Can anyone give me some values that should work? Or perhaps another solution?



For reference, my projectiles have a velocity set by:

[java]rigidControl.setLinearVelocity(normalizedDirection.mult(20f));[/java]



I posted on this about two months ago, and got a collision to register by doing a sweep test, but now I need the projectile to actually bounce. I was going to limit the bouncing behavior based on projectile speed, but an initial velocity of 20f is kind of slow in terms of a gun’s projectile. Should I do the sweep test and calculate based on the normal it hit? It seems like reinventing the wheel if I just have my parameters set wrong.



Thanks,

Duffy

Theres a TestCcd in the jMETests you can look at. And is your projectile really small? There’s a certain minimum size you should be using, to get accurate physics

I tried setting the projectile size to what’s in the TestCcd file and it seems to be working better. Should I just scale everything else up to make it look more like a bullet? Using 0.4f as a radius gives a giant bullet when I was kind of basing it on a 1f = 1 wu = 1 meter scale.

Spoke too soon. The issue still exists. Very inconsistent projectile bounces and quite often it just goes through the mesh. This is using a Sphere with radius 0.4f, a CcdMotionThreshold of 0.1f. I don’t understand how if the test works with those parameters, my code will not, even with a full 60fps framerate and half the speed.

I have the exact same Problem.
Is there another way instead of scaling my world up (i use a similar world scale)?
It would be good to mention this in the wiki along with the minimum size of the objects/shapes.

The only size in the Ccd test i found was 0.1f for a sphere collision shape and the size of a box 4,4,0.1f

My values:
[java]
float size =0.3f;
Sphere sphere = new Sphere(5, 5,size);
SphereCollisionShape sphereC = new SphereCollisionShape(size);
result = new Projectile(sphere, testMaterial, speed, startPoint, direction, sphereC, 0.4f); // last value is mass
result.getControl().setCcdSweptSphereRadius(size);
result.getControl().setCcdMotionThreshold(0.2f);
[…]//added to rootNode and physicspace …
result.getControl().setLinearVelocity(p.getDirection().mult(20));
[/java]
Even with this slow speed it still sometimes will went through.
Is there a way to get better results (instead of scaling)? Like using other collsionshapes? or increasing accuracy of physicsspace?