[java]
Vector3f wheelDirection = new Vector3f(0, -1, 0);
Vector3f wheelAxle = new Vector3f(-1, 0, 0);
Geometry wheel_fr = findGeom(carNode, "WheelFrontRight");
wheel_fr.center();
box = (BoundingBox) wheel_fr.getModelBound();
wheelRadius = box.getYExtent();
float back_wheel_h = (wheelRadius * 1.7f) - 1f; // Question 1.
float front_wheel_h = (wheelRadius * 1.9f) - 1f; // Question 1.
player.addWheel(wheel_fr.getParent(), box.getCenter().add(0, -front_wheel_h, 0),
wheelDirection, wheelAxle, 0.2f, wheelRadius, true);
Geometry wheel_fl = findGeom(carNode, "WheelFrontLeft");
wheel_fl.center();
box = (BoundingBox) wheel_fl.getModelBound();
player.addWheel(wheel_fl.getParent(), box.getCenter().add(0, -front_wheel_h, 0),
wheelDirection, wheelAxle, 0.2f, wheelRadius, true);
Geometry wheel_br = findGeom(carNode, "WheelBackRight");
wheel_br.center();
box = (BoundingBox) wheel_br.getModelBound();
player.addWheel(wheel_br.getParent(), box.getCenter().add(0, -back_wheel_h, 0),
wheelDirection, wheelAxle, 0.2f, wheelRadius, false);
Geometry wheel_bl = findGeom(carNode, "WheelBackLeft");
wheel_bl.center();
box = (BoundingBox) wheel_bl.getModelBound();
player.addWheel(wheel_bl.getParent(), box.getCenter().add(0, -back_wheel_h, 0),
wheelDirection, wheelAxle, 0.2f, wheelRadius, false);
[/java]
All source code link : http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/bullet/TestFancyCar.java
- i wonder why front_wheel_h is more longer than back_wheel_h.
and What is the reason of calculating like this. (—> (wheelRadius * 1.7f) - 1f )
- it set the position of WheelFront to WorldCentor(0,0,0) by wheel_fr.center();
and i think ‘BoundingBox’ of wheel_fr is also positioned on Center(0.0.0)
So i think that WheelFrontleft and WheelFrontright have the same connectionPoint in addwheel method.
But when i excute this test on debug weird Physics, their position is not same…i can’t understand this.
- what is the difference in TestFancyCar and TestPhysicsCar.
When they are rotating, they are not same.
TestPhysicsCar roll over easily, but TestFancyCar doesn`t roll over.
i change the value of compValue, dampValue and stiffness in TestPhysicscar.
Though the value is same between TestPhysicsCar and TestFancyCar, physicscar roll over easily.