From 3e36428568d1b26306a9639ed04aa49b578ac74e Mon Sep 17 00:00:00 2001 From: aap Date: Thu, 4 Jun 2020 17:38:41 +0200 Subject: more CBike and fixes --- src/entities/Entity.h | 2 +- src/entities/Physical.cpp | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src/entities') diff --git a/src/entities/Entity.h b/src/entities/Entity.h index f506017a..c3e4cc3b 100644 --- a/src/entities/Entity.h +++ b/src/entities/Entity.h @@ -30,7 +30,7 @@ enum eEntityStatus : uint8 STATUS_PLANE, STATUS_PLAYER_REMOTE, STATUS_PLAYER_DISABLED, - STATUS_12, // TODO: what is this? used in CPhysical::ApplyAirResistance + STATUS_GHOST }; class CEntity : public CPlaceable diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index 1f62ef64..a5a1f110 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -458,6 +458,7 @@ CPhysical::ApplyFrictionTurnForce(float jx, float jy, float jz, float px, float m_vecTurnFriction += turnimpulse*(1.0f/m_fTurnMass); } +bool debugSprings; bool CPhysical::ApplySpringCollision(float springConst, CVector &springDir, CVector &point, float springRatio, float bias) { @@ -467,6 +468,10 @@ CPhysical::ApplySpringCollision(float springConst, CVector &springDir, CVector & float impulse = -GRAVITY*m_fMass*step * springConst * compression * bias*2.0f; ApplyMoveForce(springDir*impulse); ApplyTurnForce(springDir*impulse, point); +if(debugSprings){ +printf("spring : %.3f %.3f %.3f\n", springDir.x*impulse, springDir.y*impulse, springDir.z*impulse); +printf("speed: %.3f %.3f %.3f\n", m_vecMoveSpeed.x, m_vecMoveSpeed.y, m_vecMoveSpeed.z); +} } return true; } @@ -484,6 +489,11 @@ CPhysical::ApplySpringCollisionAlt(float springConst, CVector &springDir, CVecto impulse *= 0.75f; ApplyMoveForce(forceDir*impulse); ApplyTurnForce(forceDir*impulse, point); +if(debugSprings){ +printf("spring alt: %.3f %.3f %.3f %.3f\n", forceDir.x*impulse, forceDir.y*impulse, forceDir.z*impulse, springRatio); +printf("speed: %.3f %.3f %.3f\n", m_vecMoveSpeed.x, m_vecMoveSpeed.y, m_vecMoveSpeed.z); +printf("pos: %.3f %.3f %.3f\n", GetPosition().x, GetPosition().y, GetPosition().z); +} } return true; } @@ -531,7 +541,7 @@ void CPhysical::ApplyAirResistance(void) { if(m_fAirResistance > 0.1f){ - if(GetStatus() != STATUS_12){ + if(GetStatus() != STATUS_GHOST){ float f = Pow(m_fAirResistance, CTimer::GetTimeStep()); m_vecMoveSpeed *= f; m_vecTurnSpeed *= f; -- cgit v1.2.3