physics
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include "brush.h"
|
||||
#include "physics.h"
|
||||
#include "rendering.h"
|
||||
#include "tier0/platform.h"
|
||||
#include "tier1/utlbuffer.h"
|
||||
#include "tier1/utlvector.h"
|
||||
|
||||
void CBrushEntity::Precache()
|
||||
@@ -10,7 +12,32 @@ void CBrushEntity::Precache()
|
||||
|
||||
void CBrushEntity::Spawn()
|
||||
{
|
||||
CUtlBuffer<uint32_t> indicies(m_mesh.GetSize()*3);
|
||||
for (uint32_t i = 0;i<indicies.GetSize();i++)
|
||||
{
|
||||
indicies[i]=i;
|
||||
}
|
||||
CUtlBuffer<Point<float>> triangles(m_mesh.GetSize()*3);
|
||||
uint32_t i = 0;
|
||||
for (auto tri: m_mesh)
|
||||
{
|
||||
V_memcpy(&triangles[i],tri.location,36);
|
||||
i+=1;
|
||||
}
|
||||
V_printf("indicides %i\n",indicies.GetSize());
|
||||
V_printf("vertices %i\n",triangles.GetSize());
|
||||
|
||||
px_collider_params params = {};
|
||||
params.friction = 0;
|
||||
m_collider = px_trimesh((Point<float>*)triangles.GetMemory(), triangles.GetSize(), (uint32_t(*)[3])indicies.GetMemory(), indicies.GetSize()/3 ,params);
|
||||
px_matrix mat = {};
|
||||
mat.m[0] = 1;
|
||||
mat.m[4] = 1;
|
||||
mat.m[9] = 1;
|
||||
mat.m[15] = 1;
|
||||
px_rigidbody_params param = {};
|
||||
param.gravity_scale = 1;
|
||||
m_body = px_staticbody(px, m_collider, mat);
|
||||
};
|
||||
|
||||
void CBrushEntity::Destroy()
|
||||
@@ -19,7 +46,6 @@ void CBrushEntity::Destroy()
|
||||
}
|
||||
void CBrushEntity::Think( float fDelta )
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user