different stuff in physics

This commit is contained in:
2026-03-18 18:41:28 +02:00
parent b56d85f95d
commit 79ceac1005
8 changed files with 223 additions and 18 deletions

View File

@@ -3,14 +3,35 @@
#include "entitysystem.h"
CMOBAPlayer::CMOBAPlayer()
{
m_hCuboid = g_pPhysics->CreateBall({1});
}
CMOBAPlayer::~CMOBAPlayer()
{
}
void CMOBAPlayer::Spawn()
{
CBaseEntity::Spawn();
<<<<<<< HEAD
=======
<<<<<<< HEAD
>>>>>>> a2652ed (merges)
SetPhysics(k_EPhysics_Static);
SetModel("game/core/models/sphere.fmdl");
SetScale(1);
SetAbsOrigin({0,-14.5, 0});
<<<<<<< HEAD
=======
=======
SetModel("game/core/models/sphere.fmdl");
SetScale(1);
SetAbsOrigin({0,-11.5, 0});
>>>>>>> c251089 (different stuff in physics)
>>>>>>> a2652ed (merges)
SetThink(Think);
};
@@ -26,7 +47,18 @@ void CMOBAPlayer::Think( float fDelta )
vPosition.x += m_vMovementVector.x*fDelta*5;
vPosition.z += m_vMovementVector.z*fDelta*5;
<<<<<<< HEAD
SetAbsOrigin(vPosition);
<<<<<<< HEAD
=======
=======
CastResult_t result = g_pPhysicsWorld->ShapeCast(m_hCuboid, {0,0,0,1}, vPosition, {vPosition.x, vPosition.y, -100});
if (result.m_bIsHit)
SetAbsOrigin(result.m_vCollisionPoint);
else
SetAbsOrigin(vPosition);
>>>>>>> c251089 (different stuff in physics)
>>>>>>> a2652ed (merges)
};
LINK_ENTITY_TO_CLASS(player, CMOBAPlayer)

View File

@@ -10,10 +10,14 @@ public:
DECLARE_DATADESC();
DECLARE_SERVERCLASS()
CMOBAPlayer();
virtual ~CMOBAPlayer();
virtual void Spawn( void ) override;
void Think( float fDelta );
private:
Vector m_vMovementVector = {};
HShape m_hCuboid = NULL;
};
#endif