Sry, I misclicked.
And I can’t edit the first post since the new website layout is out…
Anyways, here is the image:
You clearly see the center of mass pretty low.
But when I set my center of mass lower and lower there comes a point when it collides with the ground.
If I take it too far, my car only stands on this “center of mass”-point and no longer on the wheels!
Is there another way to do this or am I doing something wrong?
Thanks in advance!
If your vehicle collides with the ground you don’t lower the center of mass correctly. The center of mass can easily be below the ground, that doesn’t mean the vehicle collides with the ground.
@normen said:
If your vehicle collides with the ground you don't lower the center of mass correctly. The center of mass can easily be below the ground, that doesn't mean the vehicle collides with the ground.
It was my mistake. I thought you could do
[java]
compoundShape.getChildren().get(0).location.addLocal(0,camOffsetY,0);
[/java]
in order to change the CompoundCollisionShape after it has already been created.
Since the debug view showed that everything is fine, I thought it was the Center of Mass that collided with the ground.
But still thank you @sgold, I thought about that too, but didn’t want to change my model if it wasn’t absolutely necessary.
No, that can’t be the problem. I was using 3.1.0.10951 when I last tested this.
I think by now I am around long enough to have figured out the updates
Again: I was changing the location manually, after adding the child shape.
The debug view behaved as it should, but the collision shape did not update.
@m41q said:
No, that can't be the problem. I was using 3.1.0.10951 when I last tested this.
I think by now I am around long enough to have figured out the updates ;)
Again: I was changing the location manually, after adding the child shape.
The debug view behaved as it should, but the collision shape did not update.
Then you’re using a nightly build which is also prone to misbehave. Anyway it should have the new physics debug view but I don’t understand what you are saying. Moving the geometry as you did it would not move the collision shape or the collision shape in the debug view, it would only move the geometry, so the visual part. You never changed the center of mass.
ok, let me explain:
Forget the center of mass thing for a moment.
There is no visible geometry at the moment.
But there is a CompoundCollisionShape.
I already added children to it.
And then I take one ChildCollisionShape, take its location Vector and change it through addLocal(…)
After that, the CollisionShape of the CompoundCollisionShape has not changed, same physical behavior.
But the debug view shows a moved ChildCollisionShape.
This is not a problem for me anymore, I just don’t change the location vector manually anymore.
But this is what the engine does.
Ah, now I get it. Yeah, you’re badly hacking the CompoundCollisionShape there, you have to re-add the child collision shape, it cannot be moved. Similar to how you cannot just go getLocalTranlation().set(), the CollisionShapeFactory has a helper for moving the sub shapes by readding them, if that helps.