bullet: make suspension rest length of vehicle adjustable

Fixes #569
This commit is contained in:
Q Misell 2019-03-04 17:01:38 +01:00 committed by rdb
parent 0f5da1c155
commit 05eaf930b1
2 changed files with 3 additions and 3 deletions

View File

@ -171,14 +171,14 @@ set_pitch_control(PN_stdfloat pitch) {
* Factory method for creating wheels for this vehicle instance.
*/
BulletWheel BulletVehicle::
create_wheel() {
create_wheel(PN_stdfloat suspension_rest_length) {
LightMutexHolder holder(BulletWorld::get_global_lock());
btVector3 pos(0.0, 0.0, 0.0);
btVector3 direction = get_axis(_vehicle->getUpAxis());
btVector3 axle = get_axis(_vehicle->getRightAxis());
btScalar suspension(0.4);
btScalar suspension(suspension_rest_length);
btScalar radius(0.3);
btWheelInfo &info = _vehicle->addWheel(pos, direction, axle, suspension, radius, _tuning._, false);

View File

@ -85,7 +85,7 @@ PUBLISHED:
void apply_engine_force(PN_stdfloat force, int idx);
// Wheels
BulletWheel create_wheel();
BulletWheel create_wheel(PN_stdfloat suspension_rest_length=0.4);
int get_num_wheels() const;
BulletWheel get_wheel(int idx) const;