real-time altered mesh in the bge (collisions not updating)

ok so I’m working on minecraft in the bge and after deciding that using separate cubes as blocks was never going to work well, I decided to use a single mesh of cubes.

over the course of the past few hours I have learned how to interface with a meshes polygons and vertices in realtime, getting a polygon using raycast, change the uv coordinates of vertices, changing the position of vertices, etc…

what I’ve found is that moving a polygon doesn’t update the meshes’s collisions. Any ideas?

own.reinstancePhysicsMesh()

works with triangle mesh objects only,

awesome, thanks blueprint

Thank you BPR! I didn’t know this function.

Let’s say you have big map with many chunks, if all chunks would have physics wouldn’t it lag like hell?

Okey, lets only have the physics enabled in the current active chunk…
But what about NPC or some bouncy projectile? There could be a npc in every chunk or jumping between chunks.

What i would suggest is :
Check the nearest 333 space for cubes:
Spawn invisible physics cubes inside the mesh’s fake cubes.
Do it “just in time” and keep the spawn rate and count in check (re-use cubes and delete obsolete ones).

you can fake physics pretty convincingly with rays cast in the movement direction, and a sensor object (for bouncy items)

I have been looking at trying to thread a ‘moving object manager’

for object in list MoveIt:
object.worldPosition += object[‘Moving’]
object[‘Moving’]*=.975
object[‘Moving’].z-=(gravity)

this would move anything that is moving, until it’s at rest then remove it from the list,
a collision manager would also need to be in effect…

It really defeats the point in disabling physics, because raycasts still use the physics engine, as do dynamics. It will ultimately be faster to use the built in collision system, as raycasts test the entire physics world (will culling) every call.

Yeah, but the collision system seems to fail for faster moving objects, where as detecting where the item will be next frame seems to work fine,

try it yourself,

also, with a manager, anything that is not effected is off the list to be calculated upon,

I like physics, and have been toying with ‘faking it’.

The only reason I suggest a manager, is you can’t set a ‘physics radius’ on a camera using bullet can you?

this would be much much easier,