From 266dc02a44c5666860b108e3c97f35f4f360f6a6 Mon Sep 17 00:00:00 2001 From: hiker Date: Tue, 13 Nov 2018 18:34:49 +1100 Subject: [PATCH] Removed support for cushioning falls, instead increase max suspensiom force and damping compression to allow karts to fall without colliding with the terrain. Needs an increase in network protocol version. --- data/kart_characteristics.xml | 4 +- data/stk_config.xml | 2 +- src/karts/kart_rewinder.cpp | 2 - src/network/server_config.cpp | 12 ---- src/network/server_config.hpp | 2 +- src/physics/btKart.cpp | 103 ++-------------------------------- src/physics/btKart.hpp | 16 ------ 7 files changed, 10 insertions(+), 131 deletions(-) mode change 100644 => 100755 src/network/server_config.cpp diff --git a/data/kart_characteristics.xml b/data/kart_characteristics.xml index 767bc2bcd..3407aa5ee 100644 --- a/data/kart_characteristics.xml +++ b/data/kart_characteristics.xml @@ -35,7 +35,7 @@ for details. max-force: Maximum suspension force --> + exp-spring-response="false" max-force="32000" /> - + diff --git a/data/stk_config.xml b/data/stk_config.xml index 0c75d6b9d..ab20b8481 100644 --- a/data/stk_config.xml +++ b/data/stk_config.xml @@ -11,7 +11,7 @@ - + kart is hovering - // and not controllable. - m_cushioning_disable_time = 120; - - needed_cushioning = true; - btVector3 impulse = down * (-v_down.getY() + gravity*step) - / m_chassisBody->getInvMass(); -#ifdef DEBUG_CUSHIONING - float v_old = m_chassisBody->getLinearVelocity().getY(); -#endif - m_chassisBody->applyCentralImpulse(impulse); -#ifdef DEBUG_CUSHIONING - Log::verbose("physics", - "World %d Cushioning imp %f vdown %f from %f m/s to %f m/s " - "contact %f kart %f susp %f relspeed %f", - World::getWorld()->getTimeTicks(), - impulse.getY(), - -v_down.getY(), - v_old, - m_chassisBody->getLinearVelocity().getY(), - m_wheelInfo[wheel_index].m_raycastInfo.m_isInContact ? - m_wheelInfo[wheel_index].m_raycastInfo.m_contactPointWS.getY() - : -100, - m_chassisBody->getWorldTransform().getOrigin().getY(), - m_wheelInfo[wheel_index].m_raycastInfo.m_suspensionLength, - m_chassisBody->getVelocityInLocalPoint(m_wheelInfo[wheel_index] - .m_chassisConnectionPointCS) - ); -#endif - } - - // Update friction (i.e. forward force) // ------------------------------------ updateFriction( step); @@ -588,7 +497,7 @@ void btKart::updateVehicle( btScalar step ) // If configured, add a force to keep karts on the track // ----------------------------------------------------- float dif = m_kart->getKartProperties()->getStabilityDownwardImpulseFactor(); - if(dif!=0 && m_num_wheels_on_ground==4 && !needed_cushioning) + if(dif!=0 && m_num_wheels_on_ground==4) { float f = -fabsf(m_kart->getSpeed()) * dif; btVector3 downwards_impulse = m_chassisBody->getWorldTransform().getBasis() diff --git a/src/physics/btKart.hpp b/src/physics/btKart.hpp index bfcecffba..01932e26e 100644 --- a/src/physics/btKart.hpp +++ b/src/physics/btKart.hpp @@ -93,9 +93,6 @@ private: /** Number of wheels that touch the ground. */ int m_num_wheels_on_ground; - /** Number of time steps during which cushioning is disabled. */ - unsigned int m_cushioning_disable_time; - /** Index of the right axis. */ int m_indexRightAxis; /** Index of the up axis. */ @@ -252,19 +249,6 @@ public: // ------------------------------------------------------------------------ float getTimedRotationTime() const { return m_time_additional_rotation; } // ------------------------------------------------------------------------ - /** Returns the time cushioning is disabled. Used for networking state - * saving. */ - unsigned int getCushioningDisableTime() const - { - return m_cushioning_disable_time; - } // getCushioningDisableTime - // ------------------------------------------------------------------------ - /** Sets the cushioning disable time. Used for networking state saving. */ - void setCushioningDisableTime(unsigned int cdt) - { - m_cushioning_disable_time = cdt; - } // setCushioningDisableTime - // ------------------------------------------------------------------------ /** Sets the maximum speed for this kart. */ void setMaxSpeed(float new_max_speed) {