Initial JointsService and Snap implementation

This is incomplete and some issues need to be fixed
This commit is contained in:
NT_x86
2023-03-26 18:51:11 +03:00
parent 0b8847cd8e
commit 9cee74baf4
11 changed files with 162 additions and 15 deletions

View File

@@ -0,0 +1,29 @@
#include "DataModelV2/SnapInstance.h"
#include "XplicitNgine/XplicitNgine.h"
#include "StringFunctions.h"
#include "Globals.h"
SnapInstance::SnapInstance(PartInstance* Part1, PartInstance* Part2)
{
XplicitNgine* Phys = g_xplicitNgine;
name = "Snap";
className = "Snap";
Joint1 = Part1;
Joint2 = Part2;
if (Part1->physBody == NULL)
Phys->createBody(Part1);
if (Part2->physBody == NULL)
Phys->createBody(Part2);
Phys->createJoint(Part1, Part2);
}
SnapInstance::~SnapInstance(void)
{
XplicitNgine* Phys = g_xplicitNgine;
printf("SnapInstance destroyed...");
Phys->destroyJoint(Joint1);
Phys->destroyJoint(Joint2);
}