Extreme lag when a low detail collision mesh collides with ground

I have a relatively low detail model (like 100-150 polygons) and I’m using CollisionShapeFactory.createDynamicMeshShape() to get it’s collision shape. When the model lands on the map’s model (which is flat, it’s collision shape is mostly large planes) my performance drops from 60+ FPS to less than 1. I know it’s the model because when I remove it there’s no lag. It’s only when it’s close to the ground. I enabled debug to check, and I know the collision shape is pretty low detail. It’s not a very big model, and it’s only got a mass of 500. Anybody have any idea why this could be happening?

Could be the size of the main mesh, as soon as it gets in the nearphase its causing long checks. Maybe try splitting up your terrain mesh or use a more simple to handle one like a heightfield shape.

Edit: Oh and you should definitely go with hull shapes instead of gimpact shapes, they are very very cpu heavy.

Does CollisionShapeFactory give back GImpact? If so, how would I switch to hull shapes? I’m not on my working computer, but I’ll try out the heightfield collision shape.

createDynamicMeshShape should already create a hull shape, you can see it using physicsSpace.enableDebug(assetManager);

Alright, that’s what I’m using. I need to research some physics stuff. I’m thinking of doing some checks on physics to help lag with the destructible physics. On my Phenom II X4 925 @ 2.8GHz with a Radeon HD4350 512MB (really bad card. doesn’t run anything) I only get about 15 FPS because of all the parts lying in a pile. I tried amping up the sleeping thresholds for each part but it didn’t seem to change. Strange, and I just kinda forgot about it and decided I’d mess with it later. Later’s here now and I’m still lagging, so it’s fixing time. I want older systems to be able to run the game as well as newer ones. I know where all the lag is coming from and it’s the physics, with so many rigid body controls at one time. I’ve already got it so it filters out 50% of debris (customizable, if your PC can run it you can have 100% of simulated debris, or only 25%). Anyway, this was for the vehicles I’m attempting to add at the time. When I’d add a vehicle to the map it’d lag really bad when the vehicle got close to the map. I fixed it, shortly before deciding I’m just going to write my own vehicle control code. I wanna make the vehicle system similar to the building system, where when modeling you name a part something like “Wheel_WFR” to denote that it’s a Front Right wheel, or something like “Part_E” to denote that it’s an engine part (makes it so when the vehicle is damaged a smoke particle can rise from it), and also because I wanted to add destruction to vehicles as well. Like, when a grenade explodes near a vehicle, or anything explodes near it, it’ll blow off the hood, shatter the windows, bust off plates of metal, etc. So if you blow off the side of a vehicle you can snipe/shoot into it easier. The VehicleControl class doesn’t really look like it’ll suffice so I’m just writing my own. I’ll be starting on it today and posting a video whenever I have anything showable. Either way, I’m switching the collision for the map to heightfield to see if that’ll help performance. Thanks for the help!

Wow. That’s a huge paragraph. .__. Enthusiasm.