Made surface not crash, made surface release only on motor
This commit is contained in:
@@ -37,6 +37,8 @@ void SurfaceTool::onButton1MouseDown(Mouse mouse)
|
|||||||
{
|
{
|
||||||
AudioPlayer::playSound(dingSound);
|
AudioPlayer::playSound(dingSound);
|
||||||
PartInstance * target = mouse.getTarget();
|
PartInstance * target = mouse.getTarget();
|
||||||
|
if(target != NULL)
|
||||||
|
{
|
||||||
G3D::Ray ray = mouse.getLastRay();
|
G3D::Ray ray = mouse.getLastRay();
|
||||||
std::vector<G3D::Box> surfacesHit = getSurfaces(target);
|
std::vector<G3D::Box> surfacesHit = getSurfaces(target);
|
||||||
int closest;
|
int closest;
|
||||||
@@ -52,12 +54,14 @@ void SurfaceTool::onButton1MouseDown(Mouse mouse)
|
|||||||
}
|
}
|
||||||
if(G3D::isFinite(nearValue))
|
if(G3D::isFinite(nearValue))
|
||||||
{
|
{
|
||||||
|
|
||||||
printf("\n%d\n", closest);
|
|
||||||
target->setSurface(closest, Enum::SurfaceType::Value(surface));
|
target->setSurface(closest, Enum::SurfaceType::Value(surface));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(surface == Enum::SurfaceType::Motor)
|
||||||
|
{
|
||||||
g_usableApp->changeTool(NULL);
|
g_usableApp->changeTool(NULL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void SurfaceTool::onButton1MouseUp(Mouse mouse)
|
void SurfaceTool::onButton1MouseUp(Mouse mouse)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user