Changed how boxes are rendered

PhysicalInstance now has a getBox() method that returns a Box the same way it would have been rendered, also added is a getCFrameRenderBased() which returns the CFrame that would have been used in the render pass
This commit is contained in:
andreja6
2018-04-27 15:05:51 -07:00
parent 4094631f30
commit fcb1ad05fd
3 changed files with 17 additions and 36 deletions

View File

@@ -42,6 +42,17 @@ void PhysicalInstance::setCFrame(CoordinateFrame coordinateFrame)
position = coordinateFrame.translation;
}
CoordinateFrame PhysicalInstance::getCFrameRenderBased()
{
return CoordinateFrame(getCFrame().rotation,Vector3(getCFrame().translation.x/2, getCFrame().translation.y/2, getCFrame().translation.z/2));
}
Box PhysicalInstance::getBox()
{
Box box = Box(Vector3(0+size.x/4, 0+size.y/4, 0+size.z/4) ,Vector3(0-size.x/4,0-size.y/4,0-size.z/4));
CoordinateFrame c = getCFrameRenderBased();
return c.toWorldSpace(box);
}
PhysicalInstance::~PhysicalInstance(void)
{