constraints work. Why? because i said so!

This commit is contained in:
Jasper 2015-01-23 12:59:28 +01:00
parent 13df9c14a8
commit 81c09eb33a
5 changed files with 106 additions and 6 deletions

View File

@ -230,6 +230,9 @@
<ignoreHeightmap>true</ignoreHeightmap>
<object>
<modelPath>SimpleWall.obj</modelPath>
<xRot>0.0</xRot>
<yRot>0.0</yRot>
<zRot>0.0</zRot>
<xOffset>0.0</xOffset>
<yOffset>40.0</yOffset>
<zOffset>0.0</zOffset>
@ -244,11 +247,14 @@
<ignoreHeightmap>false</ignoreHeightmap>
<object>
<modelPath>block.obj</modelPath>
<xOffset>0.0</xOffset>
<yOffset>5.0</yOffset>
<xOffset>0.0</xOffset>
<yOffset>20.0</yOffset>
<zOffset>0.0</zOffset>
<xRot>0.0</xRot>
<yRot>0.0</yRot>
<zRot>0.0</zRot>
<scale>1.5</scale>
<mass>1.0</mass>
<mass>2.0</mass>
</object>
</composition>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

View File

@ -8,7 +8,7 @@
<yOffset>0.0</yOffset>
<zPos>-220.500000</zPos>
<idGreen>2</idGreen>
<idBlue>221</idBlue>
<idBlue>224</idBlue>
<typeID>20</typeID>
<trigger>
<name>-</name>
@ -37,7 +37,7 @@
<yOffset>0.0</yOffset>
<zPos>-220.500000</zPos>
<idGreen>2</idGreen>
<idBlue>220</idBlue>
<idBlue>223</idBlue>
<typeID>80</typeID>
<trigger>
<name>-</name>
@ -56,6 +56,100 @@
</trigger>
</composition>
<composition>
<scale>1.0</scale>
<xRot>0.0</xRot>
<yRot>0.0</yRot>
<zRot>0.0</zRot>
<manualPos>false</manualPos>
<xPos>200.500000</xPos>
<yOffset>0.0</yOffset>
<zPos>-222.500000</zPos>
<idGreen>2</idGreen>
<idBlue>222</idBlue>
<typeID>200</typeID>
<trigger>
<name>-</name>
<xPosition>0</xPosition>
<yPosition>0</yPosition>
<zPosition>0</zPosition>
<targetIdGreen>-</targetIdGreen>
<targetIdBlue>-</targetIdBlue>
<distance>1.0</distance>
<isBiggerThan>false</isBiggerThan>
<objectNum>0</objectNum>
<luaScript>-</luaScript>
<toChangeIdGreen>0</toChangeIdGreen>
<toChangeIdBlue>0</toChangeIdBlue>
<toChangeObjNum>0</toChangeObjNum>
</trigger>
<positionConstraint>
<objectNum>0</objectNum>
<xPosition>200.5</xPosition>
<yPosition>30.0</yPosition>
<zPosition>-222.5</zPosition>
<strength>20</strength>
</positionConstraint>
</composition>
<composition>
<scale>1.0</scale>
<xRot>0.0</xRot>
<yRot>0.0</yRot>
<zRot>0.0</zRot>
<manualPos>false</manualPos>
<xPos>198.500000</xPos>
<yOffset>0.0</yOffset>
<zPos>-213.500000</zPos>
<idGreen>2</idGreen>
<idBlue>221</idBlue>
<typeID>200</typeID>
<trigger>
<name>-</name>
<xPosition>0</xPosition>
<yPosition>0</yPosition>
<zPosition>0</zPosition>
<targetIdGreen>-</targetIdGreen>
<targetIdBlue>-</targetIdBlue>
<distance>1.0</distance>
<isBiggerThan>false</isBiggerThan>
<objectNum>0</objectNum>
<luaScript>-</luaScript>
<toChangeIdGreen>0</toChangeIdGreen>
<toChangeIdBlue>0</toChangeIdBlue>
<toChangeObjNum>0</toChangeObjNum>
</trigger>
</composition>
<composition>
<scale>1.0</scale>
<xRot>0.0</xRot>
<yRot>0.0</yRot>
<zRot>0.0</zRot>
<manualPos>false</manualPos>
<xPos>191.500000</xPos>
<yOffset>0.0</yOffset>
<zPos>-213.500000</zPos>
<idGreen>2</idGreen>
<idBlue>220</idBlue>
<typeID>200</typeID>
<trigger>
<name>-</name>
<xPosition>0</xPosition>
<yPosition>0</yPosition>
<zPosition>0</zPosition>
<targetIdGreen>-</targetIdGreen>
<targetIdBlue>-</targetIdBlue>
<distance>1.0</distance>
<isBiggerThan>false</isBiggerThan>
<objectNum>0</objectNum>
<luaScript>-</luaScript>
<toChangeIdGreen>0</toChangeIdGreen>
<toChangeIdBlue>0</toChangeIdBlue>
<toChangeObjNum>0</toChangeObjNum>
</trigger>
</composition>
<composition>
<scale>1.0</scale>
<xRot>0.0</xRot>

View File

@ -25,7 +25,7 @@ void Physics::takeUpdateStep(float timeDiff)
{
if(allPositionConstraints[i].position != allPositionConstraints[i].body->getCenterOfMassPosition())
{
btVector3 dir = allPositionConstraints[i].body->getCenterOfMassPosition() - allPositionConstraints[i].position;
btVector3 dir = allPositionConstraints[i].position - allPositionConstraints[i].body->getCenterOfMassPosition();
allPositionConstraints[i].body->applyCentralForce(dir*allPositionConstraints[i].strength);
}
}