Running into a problem and hoping you could help :D:
My vehicles go through walls on my android version of my lil game.
Doesn’t happen when I run the same code on desktop windows 64.
Developed, built and run using the sdk and jMonkeyEngine 3.0.10.
Target android: Samsung G3 I8190 mini using android 4.1.2.
On my side, the only change when running that version on android is a different input listener. A part from one initialization process run once that can’t have an influence here.
I’ve tried:
smaller circuit triangles
changing accuracy
changing maxSubSteps
playing with CcdMotionThreshold (and the sphere method)
tried making a bigger collision shape for the hull of the vehicles
Basically, the wheels stay on the track fine, but whenever the hull collides, it just goes through and the wheels follow through.
Doesn’t require a big speed or a big torque, low fps or anything such.
I don’t see any errors in the logs.
At this point, all I can think of is an appState checking distances to determine when a vehicle is out of the circuit, making a boom and putting it back on pretending nothing happened :D. But it really doesn’t fit my agenda.
Any idea? Is the bullet used by android doing something special I should know of? I suspect accuracy changed might not be taken into account, but this is deeper than that.
Any information would be great (such as what bullet is used etc), because I’m pretty out of solutions.
These are the libraries used. They were inserted there by the sdk (dunno if helps):
jME3-jBullet.jar
jbullet.jar
jME3-bullet.jar
jME3-bullet-natives-android.jar
I use a BoxCollisionShape added to a CompoudCollisionShape:
protected CollisionShape createCollisionShape(VehicleData vehicleData, Vehicle vehicle) {
CompoundCollisionShape compoundShape = new CompoundCollisionShape();
BoxCollisionShape collisionShape = new BoxCollisionShape(vehicleData.getVector3f("CollisionVector"));
compoundShape.addChildShape(collisionShape, new Vector3f(0, 1, 0));
return compoundShape;
// return CollisionShapeFactory.createDynamicMeshShape(vehicle.getVehicleGeometry());
}
But I tested with a MeshShape too just in case.
-edit-
My circuit is made of a MeshCollisionShape. I’m going from the idea that the circuit can be a MeshCollisionShape if the vehicle is a simple shape?
I’m using a CompoundCollisionShape because I haven’t found another way to translate the BoxCollisionShape upwards so it doesn’t touch the surface.
do you ever move the circuit? as that invalidates the whole MeshCollisionShape.
Also how many polygons does it have? bullet can be a pit picky for larger meshes.
CompundCollision shape should be fine. Btw maybee a hullcollisionshape would be more usefull for a car, anyway that should not be the problem.
@ - Empire_Phoenix
I don’t move the circuit. It is procedurally built where I want it.
Some parts have long triangles, but it fails in the curbs and when meeting obstacles, and those are made of small triangles.
I use a BoxCollisionShape for better performances. I would use it without a CompoundCollisionShape but using that CompoundCollisionShape is the only way I found (well copy pasted from the tutorial :D) to move the collision shape upwards.
@ - normen:
I tried with that method and have the same results. You might have been pointing to that and I missed it.
Tried collisions with a simple RigidBodyControl (no vehicleControl) and it then works fine with a BoxCollisionShapeand and a CompoundCollisionShape.
I also gave impulses following touchs to those boxes and it worked fine (box was blocked by walls).
Grumpf, this is an elusive problem :D.
Tried an even bigger CollisionShape to no result, still, at 1/20th of the speed it goes on fine with desktop, it doesn’t bump on a vertical wall, it goes through it and ends up flying in space.
To me it seems that the wheels work fine but the hull collision shape is messed up when using a vehicleControl.
Posting this in case someone has a spark… because I’m kind of lost.
This is the only problem I’m (completely) stuck with. I don’t know what to do from there.
After that, I can focus on the visuals, making nice tracks and easy stuff.
I’ll build a shrine to anybody that can give me a good pointer .
I’m very sorry for having wasted you peeps time… I’m a friggin idiot! And it’s genetic, not behavioural… was really careful, but seems at some point I removed a call to setCollisionGroup and setCollideWithGroups. I’ve checked that multiple times but seems I checked it moronically.
As I was told, jBullet can be more forgiving, and probably by defaults makes all objects collide while bullet doesn’t and that’s why the problem only occurred under android.
It now works… thx to all that gave ideas, and very sorry for wasting your time.
Actually the bullet version does that check (collision group vs collide with group) wrong, it was contributed at some point and I didn’t get to fix it yet. But it would have helped to know that you use it at all
I don’t know what to say haha… I really checked it because it was an obvious potential culprit… would be nice to have some brain unit tests to check it’s working correctly before using it to check assumptions XD.
Anyway, it’s working now perfectly and I’m dancing in circles giggling like an old fool.