From 05eaf930b17aef35a3922e6f92a42320f8cf0447 Mon Sep 17 00:00:00 2001 From: Q Misell Date: Mon, 4 Mar 2019 17:01:38 +0100 Subject: [PATCH] bullet: make suspension rest length of vehicle adjustable Fixes #569 --- panda/src/bullet/bulletVehicle.cxx | 4 ++-- panda/src/bullet/bulletVehicle.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/panda/src/bullet/bulletVehicle.cxx b/panda/src/bullet/bulletVehicle.cxx index ba7ee35d6d..adb5d6c692 100644 --- a/panda/src/bullet/bulletVehicle.cxx +++ b/panda/src/bullet/bulletVehicle.cxx @@ -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); diff --git a/panda/src/bullet/bulletVehicle.h b/panda/src/bullet/bulletVehicle.h index 9f9da751c3..486e38a049 100644 --- a/panda/src/bullet/bulletVehicle.h +++ b/panda/src/bullet/bulletVehicle.h @@ -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;