Hello,In Testphysicscar.java when i steer car on high speeds it is flipping over.Is there a way to stop flipping over of car?
Maybe you can try to reduce the friction of the wheels?
Changing friction of wheels affects car steering it doesnt look normal.
I read related topics before creating this topic.They dont have specific solution and just talking about changing center of mass.I dont know how to change center of mass.
The center of mass is always at the center of the physics object (i.e. the point that moves to 0/0/0 if you move the object to 0/0/0). To offset the center of mass you offset the collision shape. So if the object is at 0/0/0 and you add the collision shape at 0/1/0 the center of mass is effectively at 0/-1/0 (relative to the collision shape)
If I understand right you are saying change the code on line 106
compoundShape.addChildShape(box, new Vector3f(0, 1, 0)); .
But when i reduce its y axis ,it change the place of collisionshape too.I want to use collision shape on up because i have atv model(its car body on upper place in comparison to fancy car) and want to use it as a physics car.
And also, setting a car up for perfect gravity, balance, just the right amount of rear slip, etc… is all a bit of an art in itself. It will require tedious amounts of fiddling without a simple gui debug screen to get right. Its what makes a ferrari a ferrari, and an aston martin a ‘wonderful to drive’ big fat tank on wheels.
I am searching possible solutions for a couple of day.Can I make it by applying impulse which direction is ground on car or wheels?When i apply impulse on car its wheels are getting under the floor.
Setting rollinfluence of every wheel to 0 works for me.But now when i brake it is flipping over on z axis.I configured brakes and now only back wheels of car brakes, it is not flipping over on z.But it’s rotation is changing when i brake
in the speeds more than 50 km/h.
The solution IS moving the center of mass.
As I said before changing center of mass also changes place of collision shape.I want to use collision place on it’s right place.Also even when i change it is center of mass it is rolling over easily because of car’s collisionshape bottom not square(it has round bottom).You can think my car as a normal physics car only difference is it’s wheel yOff is -0.5f .
Not according the tutorial.
Best Practice: We attach the BoxCollisionShape (the vehicle body) to the CompoundCollisionShape at a Vector of (0,1,0): This shifts the effective center of mass of the BoxCollisionShape downwards to 0,-1,0 and makes a moving vehicle more stable!
compoundShape.addChildShape(box, new Vector3f(0, 1, 0));
But it result with move on collision shape.Tutorial just say it makes more stable.
But that’s what you’re looking for. Stability.
Give it a whirl regardless and see what happens.
I will implement my atv on physics car that is why collision shape’s place is important for me to listen collision detection of atv.Setting roll influence to 0 works well for me.But brakes are still problem.
The braking results in flipping… Which is due to your center of mass being too high.
You don’t get it. You have to move the center of mass, not the collision shape itself. So the shape has to move up when you move its center down… The center of a collision shape is always its center of mass.
To create a collision shape with its center of mass outside of its volume:
- Create a node “A” at 0/0/0
- Attach a box “B” at local translation 10/0/0
- Make a collision shape from node “A”.
- Now note how the collision shape looks like a box at 10/0/0 but its center of mass is at 0/0/0
This is because of what was said repeatedly now - the collision shape always has its center of mass at its origin. The collision shape was generated from the node at 0/0/0, so thats its origin. The volume or mesh of the collision shape was at 10/0/0 though, so thats where you see it and bump into it.
@normen I have tried to code like you said and also set yoff of wheel to -.5f . This is my code it is in buildplayer function.
Box b=new Box(1.2f,0.5f,2.4f);
Geometry geom = new Geometry(“Box”, b);
geom.setLocalTranslation(0, 10, 0);
Node z=new Node();
CollisionShape carHull = CollisionShapeFactory.createDynamicMeshShape(z);
Node vehicleNode=new Node(“vehicleNode”);
vehicle = new VehicleControl(carHull, 400);
Am i doing it wrong?
If it doesn’t work then yes, you are doing it wrong.