From 2fb002aab19b0b08bf41c68a41dff7ff8149159d Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Thu, 28 Sep 2023 18:43:22 -0700 Subject: [PATCH] NSPhysicsEntity: Create identifier .isPhysics unique to physics based entities --- src/shared/NSPhysicsEntity.h | 4 +++- src/shared/NSPhysicsEntity.qc | 13 ++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/shared/NSPhysicsEntity.h b/src/shared/NSPhysicsEntity.h index 79217678..388377e1 100644 --- a/src/shared/NSPhysicsEntity.h +++ b/src/shared/NSPhysicsEntity.h @@ -120,4 +120,6 @@ public: nonvirtual void ApplyTorqueCenter(vector); /** Called by the physics routine to figure out the impact damage. */ nonvirtual float CalculateImpactDamage(int,int); -}; \ No newline at end of file +}; + +noref .bool isPhysics; \ No newline at end of file diff --git a/src/shared/NSPhysicsEntity.qc b/src/shared/NSPhysicsEntity.qc index a40d4abf..ba88093e 100644 --- a/src/shared/NSPhysicsEntity.qc +++ b/src/shared/NSPhysicsEntity.qc @@ -14,11 +14,12 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -//#define ODE_MODE 1 +#define ODE_MODE 1 void NSPhysicsEntity::NSPhysicsEntity(void) { + isPhysics = true; mass = 1.0f; m_flInertiaScale = 1.0f; @@ -412,8 +413,11 @@ NSPhysicsEntity::ApplyForceCenter(vector vecForce) { if (physics_supported() == TRUE) { physics_addforce(this, vecForce, [0,0,0]); +#ifdef ODE_MODE + //velocity += vecForce; +#endif } else { - velocity = vecForce; + velocity += vecForce; } /* make sure touch think is called */ @@ -425,8 +429,11 @@ NSPhysicsEntity::ApplyForceOffset(vector vecForce, vector vecOffset) { if (physics_supported() == TRUE) { physics_addforce(this, vecForce, vecOffset); +#ifdef ODE_MODE + //velocity += vecForce; +#endif } else { - velocity = vecForce; + velocity += vecForce; } /* make sure touch think is called */