In TestFancyCar, I question about 'AddWheel part' of TestFancyCar source code

[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


  1. 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 )


  2. 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.


  3. 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.
  1. cause it looks and works good
  2. no the bounding box is not in the center, the center of the wheel is at 0/0/0, thats why we want the bounding box center, which is the visual centerr of the wheel
  3. the different values of the settings, e.g. size, position of the wheels, center of mass etc.
@normen said:
1) cause it looks and works good
2) no the bounding box is not in the center, the center of the wheel is at 0/0/0, thats why we want the bounding box center, which is the visual centerr of the wheel
3) the different values of the settings, e.g. size, position of the wheels, center of mass etc.

thank you for your reply ^^!
1. I wonder that How could you get this expression. Did You get this expression by running TestProject repeatedly?

2. Yes, i understand this^^
  1. All :P.