Big physics object inside GhostControl ---> lag

Hey monkeys,

What I’m trying to achieve is spawning a big vehicle.
In order to do that I have to somehow check wether no other object is blocking the way to prevent spawning something in something else.
I thought a GhostControl may be suited for that task.
It works fine at first, but when the vehicle spawns, it starts lagging horribly. The vehicles collision shape is a standard generated MeshCollisionShape.
And while I have to admit that it has too many triangles that I don’t really need for physics, it should just work fine, shouldn’t it?

When I shrink the GhostControls volume to cover only a little part of the vehicle, framerate goes up.
I only check for overlapping objects every ten seconds; in the meantime I don’t even need the GhostControl to do anything.

Is there a reason (and a fix) for this gigantic lag when something is inside the ghost controls volume?
If you have any other suggestions on checking the spawn area for other object, please let me know as well.

Thanks in advance!

A MeshCollisionShape is for static objects.

1 Like
@normen said: A MeshCollisionShape is for static objects.

Ok, thanks, roger that.
I just wasn’t sure what to pick since I wanted a kinematic object and there was only MeshCollisionShape (for static objects) and DynamicMeshCollisionShape.

Anyways…
I imagine it’s the same with any other collision objects, so…
Is there a way to check if the spawning point is avaiable without that performance impact?

I guess I’ll have to use a collision shape with fewer triangles anyways, but I don’t need the GhostControl to
check each and every object inside it every frame. I only need it every ten seconds sometimes; especially when its impacts
performance that badly (from 250 fps to 0.5fps).

@m41q said: I imagine it's the same with any other collision objects, so...

You should verify that instead of assuming it, it shouldn’t be, thats why I tell you. The collision shapes that are made for dynamic objects are hull shapes with fewer polygons anyway.

Oh man, I talked without testing:
If you use DynamicMeshCollisionShape it’s nearly no performance impact at all somehow.

I don’t know why a simple MeshCollisionShape is causing that much lag and its definitly weird somehow.
But for my personal case this can be considered as fixed, thanks!

@m41q said: I don't know why a simple MeshCollisionShape is causing that much lag and its definitly weird somehow.
Its because you move it.
@normen said: You should verify that instead of assuming it, it shouldn't be, thats why I tell you.

Okok, I was a bit overhasty :roll:

@normen said: Its because you move it.
Hm no, I wasn't moving it at all. But it doesn't matter anymore.

Btw, you can’t make a topic not a support topic at the moment, can you?

@m41q said: Hm no, I wasn't moving it at all. But it doesn't matter anymore.
It was the collision shape of a vehicle, it most certainly moved.
@m41q said: Btw, you can't make a topic not a support topic anymore, can you?
You can close it, too. With the "edit" link on top.
@normen said: It was the collision shape of a vehicle, it most certainly moved.

I didn’t implement any movement yet.
It most certainly was just standing still =D

@m41q said: I didn't implement any movement yet. It most certainly was just standing still xD

When the simulation starts the suspension will give in and the vehicle body moves down.

@normen said: You can close it, too. With the "edit" link on top.

Hm, I somehow cannot find that link…
The ‘edit’ over each of my posts I find, of course, but then there is no close button…

@normen said: When the simulation starts the suspension will give in and the vehicle body moves down.
But it will not do that if the vehicle has a mass of zero.
@m41q said: But it will not do that if the vehicle has a mass of zero.

Right, but a mass of zero indicates a static object anyway. If you do everything wrong then I guess you can’t call the behavior of the engine “weird” anymore ^^

@m41q said: Hm, I somehow cannot find that link... The 'edit' over each of my posts I find, of course, but then there is no close button...
No idea, I just see the admin view so I don't know how it looks for you, its a dropdown, not a button though.
@normen said: Right, but a mass of zero indicates a static object anyway. If you do everything wrong then I guess you can't call the behavior of the engine "weird" anymore ^^
Hehe, I guess you're right.
@normen said: No idea, I just see the admin view so I don't know how it looks for you, its a dropdown, not a button though.

Hm. Well, I don’t see any dropdowns anywhere from my POV.