Added getMass to part

This commit is contained in:
DirtPiper
2019-10-26 15:54:48 -04:00
parent 3417a34f37
commit 4a82c67fdc
3 changed files with 14 additions and 1 deletions

View File

@@ -3,7 +3,7 @@
ProjectType="Visual C++" ProjectType="Visual C++"
Version="8.00" Version="8.00"
Name="G3DTest" Name="G3DTest"
ProjectGUID="{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}" ProjectGUID="{277D185B-AEBA-4F75-A7FC-F1EBE787C200}"
RootNamespace="G3DTest" RootNamespace="G3DTest"
> >
<Platforms> <Platforms>

View File

@@ -149,6 +149,18 @@ CoordinateFrame PartInstance::getCFrameRenderBased()
{ {
return cFrame;//CoordinateFrame(getCFrame().rotation,Vector3(getCFrame().translation.x, getCFrame().translation.y, getCFrame().translation.z)); return cFrame;//CoordinateFrame(getCFrame().rotation,Vector3(getCFrame().translation.x, getCFrame().translation.y, getCFrame().translation.z));
} }
// Start Physics stuff
float PartInstance::getMass()
{
if(shape == Enum::Shape::Sphere || shape == Enum::Shape::Cylinder){
return (4/3) * 3.1415926535 * pow(size.x/2, 3);
}
return size.x * size.y * size.z;
}
#ifdef NEW_BOX_RENDER #ifdef NEW_BOX_RENDER
Box PartInstance::getBox() Box PartInstance::getBox()
{ {

View File

@@ -45,6 +45,7 @@ public:
void debugPrintVertexIDs(RenderDevice* rd, GFontRef font, Matrix3 camRot); void debugPrintVertexIDs(RenderDevice* rd, GFontRef font, Matrix3 camRot);
void makeFace(int vertex1, int vertex2, int vertex3); void makeFace(int vertex1, int vertex2, int vertex3);
bool isUniqueVertex(Vector3 pos); bool isUniqueVertex(Vector3 pos);
float getMass();
private: private:
Vector3 position; Vector3 position;
Vector3 size; Vector3 size;