Added PartInstance->Collides function
This commit is contained in:
@@ -206,8 +206,27 @@ void PartInstance::setCFrame(CoordinateFrame coordinateFrame)
|
||||
// Can probably be deleted
|
||||
CoordinateFrame PartInstance::getCFrameRenderBased()
|
||||
{
|
||||
return 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));
|
||||
}
|
||||
|
||||
bool PartInstance::collides(PartInstance * part)
|
||||
{
|
||||
if(shape == Enum::Shape::Block)
|
||||
{
|
||||
if(part->shape == Enum::Shape::Block)
|
||||
return G3D::CollisionDetection::fixedSolidBoxIntersectsFixedSolidBox(getBox(), part->getBox());
|
||||
else
|
||||
return G3D::CollisionDetection::fixedSolidSphereIntersectsFixedSolidBox(part->getSphere(), getBox());
|
||||
}
|
||||
else
|
||||
{
|
||||
if(part->shape == Enum::Shape::Block)
|
||||
return G3D::CollisionDetection::fixedSolidSphereIntersectsFixedSolidBox(getSphere(), part->getBox());
|
||||
else
|
||||
return G3D::CollisionDetection::fixedSolidSphereIntersectsFixedSolidSphere(getSphere(), part->getSphere());
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NEW_BOX_RENDER
|
||||
Box PartInstance::getBox()
|
||||
{
|
||||
@@ -216,6 +235,13 @@ Box PartInstance::getBox()
|
||||
itemBox = c.toWorldSpace(box);
|
||||
return itemBox;
|
||||
}
|
||||
Sphere PartInstance::getSphere()
|
||||
{
|
||||
Sphere sphere = Sphere(Vector3(0,0,0), size.y/2);
|
||||
CoordinateFrame c = getCFrameRenderBased();
|
||||
//itemBox = c.toWorldSpace(Sphere);
|
||||
return sphere;//itemBox;
|
||||
}
|
||||
#else
|
||||
Box PartInstance::getBox()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user