Made physics work

This commit is contained in:
Vulpovile
2022-10-02 15:54:38 -07:00
parent 316359a395
commit e17aa16086
7 changed files with 51 additions and 26 deletions

View File

@@ -292,6 +292,7 @@ bool DataModelInstance::scanXMLObject(xml_node<> * scanNode)
xml_node<> *propNode = node->first_node();
xml_node<> *cFrameNode=0;
xml_node<> *sizeNode=0;
xml_node<> *anchoredNode=0;
xml_node<> *shapeNode=0;
xml_node<> *colorNode=0;
xml_node<> *brickColorNode=0;
@@ -307,6 +308,10 @@ bool DataModelInstance::scanXMLObject(xml_node<> * scanNode)
if (xmlValue=="CFrame" | xmlValue=="CoordinateFrame")
{
cFrameNode = partPropNode;
}
if (xmlValue=="Anchored")
{
anchoredNode = partPropNode;
}
if (xmlValue=="Name")
{
@@ -418,6 +423,11 @@ bool DataModelInstance::scanXMLObject(xml_node<> * scanNode)
{
test->color = bcToRGB(atoi(brickColorNode->value()));
}
if(anchoredNode)
{
printf("AAAAAAAAAAAAAAAAAAAA %s\n", anchoredNode->value());
test->anchored = stricmp(anchoredNode->value(), "true") == 0;
}
test->setSize(Vector3(sizeX,sizeY+_modY,sizeZ));
test->setName(newName);
CoordinateFrame cf;

View File

@@ -28,6 +28,13 @@ PartInstance::PartInstance(void)
shape = Enum::Shape::Block;
}
float PartInstance::getMass()
{
if(shape == Enum::Shape::Block)
return size.x*size.y*size.z*0.7F;
else
return 1.3333333333333333333333333333333F*(size.x/2)*(size.y/2)*(size.z/2)*0.7F;
}
Vector3 PartInstance::getVelocity()
{