@@ -16,9 +16,9 @@ public class CompoundTestDemo : Demo
16
16
{
17
17
public unsafe override void Initialize ( Camera camera )
18
18
{
19
- camera . Position = new Vector3 ( - 3f , 3 , - 3f ) ;
19
+ camera . Position = new Vector3 ( - 13f , 6 , - 13f ) ;
20
20
camera . Yaw = MathHelper . Pi * 3f / 4 ;
21
- camera . Pitch = MathHelper . Pi * 0.1f ;
21
+ camera . Pitch = MathHelper . Pi * 0.05f ;
22
22
Simulation = Simulation . Create ( BufferPool , new TestCallbacks ( ) ) ;
23
23
Simulation . PoseIntegrator . Gravity = new Vector3 ( 0 , - 10 , 0 ) ;
24
24
@@ -61,7 +61,7 @@ public unsafe override void Initialize(Camera camera)
61
61
const float gridSpacing = 1.5f ;
62
62
const int gridWidth = 3 ;
63
63
var gridShapeIndex = Simulation . Shapes . Add ( ref gridShape ) ;
64
- gridShape . ComputeLocalInverseInertia ( 1 , out var gridBoxInertia ) ;
64
+ gridShape . ComputeInertia ( 1 , out var gridBoxInertia ) ;
65
65
float localPoseOffset = - 0.5f * gridSpacing * ( gridWidth - 1 ) ;
66
66
for ( int i = 0 ; i < gridWidth ; ++ i )
67
67
{
@@ -72,7 +72,7 @@ public unsafe override void Initialize(Camera camera)
72
72
Orientation = BepuUtilities . Quaternion . Identity ,
73
73
Position = new Vector3 ( localPoseOffset , 0 , localPoseOffset ) + new Vector3 ( gridSpacing ) * new Vector3 ( i , 0 , j )
74
74
} ;
75
- compoundBuilder . Add ( gridShapeIndex , ref localPose , ref gridBoxInertia , 1 ) ;
75
+ compoundBuilder . Add ( gridShapeIndex , ref localPose , ref gridBoxInertia . InverseInertiaTensor , 1 ) ;
76
76
}
77
77
}
78
78
compoundBuilder . BuildDynamicCompound ( out var gridChildren , out var gridInertia , out var center ) ;
@@ -104,16 +104,16 @@ public unsafe override void Initialize(Camera camera)
104
104
//Build a table and use it for a couple of different tests.
105
105
{
106
106
var legShape = new Box ( 0.2f , 1 , 0.2f ) ;
107
- legShape . ComputeLocalInverseInertia ( 1f , out var legInverseInertia ) ;
107
+ legShape . ComputeInertia ( 1f , out var legInverseInertia ) ;
108
108
var legShapeIndex = Simulation . Shapes . Add ( ref legShape ) ;
109
109
var legPose0 = new RigidPose { Position = new Vector3 ( - 1.5f , 0 , - 1.5f ) , Orientation = BepuUtilities . Quaternion . Identity } ;
110
110
var legPose1 = new RigidPose { Position = new Vector3 ( - 1.5f , 0 , 1.5f ) , Orientation = BepuUtilities . Quaternion . Identity } ;
111
111
var legPose2 = new RigidPose { Position = new Vector3 ( 1.5f , 0 , - 1.5f ) , Orientation = BepuUtilities . Quaternion . Identity } ;
112
112
var legPose3 = new RigidPose { Position = new Vector3 ( 1.5f , 0 , 1.5f ) , Orientation = BepuUtilities . Quaternion . Identity } ;
113
- compoundBuilder . Add ( legShapeIndex , ref legPose0 , ref legInverseInertia , 1 ) ;
114
- compoundBuilder . Add ( legShapeIndex , ref legPose1 , ref legInverseInertia , 1 ) ;
115
- compoundBuilder . Add ( legShapeIndex , ref legPose2 , ref legInverseInertia , 1 ) ;
116
- compoundBuilder . Add ( legShapeIndex , ref legPose3 , ref legInverseInertia , 1 ) ;
113
+ compoundBuilder . Add ( legShapeIndex , ref legPose0 , ref legInverseInertia . InverseInertiaTensor , 1 ) ;
114
+ compoundBuilder . Add ( legShapeIndex , ref legPose1 , ref legInverseInertia . InverseInertiaTensor , 1 ) ;
115
+ compoundBuilder . Add ( legShapeIndex , ref legPose2 , ref legInverseInertia . InverseInertiaTensor , 1 ) ;
116
+ compoundBuilder . Add ( legShapeIndex , ref legPose3 , ref legInverseInertia . InverseInertiaTensor , 1 ) ;
117
117
var tableTopPose = new RigidPose { Position = new Vector3 ( 0 , 0.6f , 0 ) , Orientation = BepuUtilities . Quaternion . Identity } ;
118
118
var tableTopShape = new Box ( 3.2f , 0.2f , 3.2f ) ;
119
119
compoundBuilder . Add ( ref tableTopShape , ref tableTopPose , 3 ) ;
@@ -167,20 +167,20 @@ public unsafe override void Initialize(Camera camera)
167
167
Simulation . Bodies . Add ( ref tableDescription ) ;
168
168
169
169
var clampPieceShape = new Box ( 2f , 0.1f , 0.3f ) ;
170
- clampPieceShape . ComputeLocalInverseInertia ( 1f , out var clampPieceInverseInertia ) ;
170
+ clampPieceShape . ComputeInertia ( 1f , out var clampPieceInverseInertia ) ;
171
171
var clampPieceShapeIndex = Simulation . Shapes . Add ( ref clampPieceShape ) ;
172
172
var clamp0 = new RigidPose { Position = new Vector3 ( 0 , - 0.2f , - 1.1f ) , Orientation = BepuUtilities . Quaternion . Identity } ;
173
173
var clamp1 = new RigidPose { Position = new Vector3 ( 0 , 0.2f , - 1.1f ) , Orientation = BepuUtilities . Quaternion . Identity } ;
174
174
var clamp2 = new RigidPose { Position = new Vector3 ( 0 , - 0.2f , 0 ) , Orientation = BepuUtilities . Quaternion . Identity } ;
175
175
var clamp3 = new RigidPose { Position = new Vector3 ( 0 , 0.2f , 0 ) , Orientation = BepuUtilities . Quaternion . Identity } ;
176
176
var clamp4 = new RigidPose { Position = new Vector3 ( 0 , - 0.2f , 1.1f ) , Orientation = BepuUtilities . Quaternion . Identity } ;
177
177
var clamp5 = new RigidPose { Position = new Vector3 ( 0 , 0.2f , 1.1f ) , Orientation = BepuUtilities . Quaternion . Identity } ;
178
- compoundBuilder . Add ( clampPieceShapeIndex , ref clamp0 , ref clampPieceInverseInertia , 1 ) ;
179
- compoundBuilder . Add ( clampPieceShapeIndex , ref clamp1 , ref clampPieceInverseInertia , 1 ) ;
180
- compoundBuilder . Add ( clampPieceShapeIndex , ref clamp2 , ref clampPieceInverseInertia , 1 ) ;
181
- compoundBuilder . Add ( clampPieceShapeIndex , ref clamp3 , ref clampPieceInverseInertia , 1 ) ;
182
- compoundBuilder . Add ( clampPieceShapeIndex , ref clamp4 , ref clampPieceInverseInertia , 1 ) ;
183
- compoundBuilder . Add ( clampPieceShapeIndex , ref clamp5 , ref clampPieceInverseInertia , 1 ) ;
178
+ compoundBuilder . Add ( clampPieceShapeIndex , ref clamp0 , ref clampPieceInverseInertia . InverseInertiaTensor , 1 ) ;
179
+ compoundBuilder . Add ( clampPieceShapeIndex , ref clamp1 , ref clampPieceInverseInertia . InverseInertiaTensor , 1 ) ;
180
+ compoundBuilder . Add ( clampPieceShapeIndex , ref clamp2 , ref clampPieceInverseInertia . InverseInertiaTensor , 1 ) ;
181
+ compoundBuilder . Add ( clampPieceShapeIndex , ref clamp3 , ref clampPieceInverseInertia . InverseInertiaTensor , 1 ) ;
182
+ compoundBuilder . Add ( clampPieceShapeIndex , ref clamp4 , ref clampPieceInverseInertia . InverseInertiaTensor , 1 ) ;
183
+ compoundBuilder . Add ( clampPieceShapeIndex , ref clamp5 , ref clampPieceInverseInertia . InverseInertiaTensor , 1 ) ;
184
184
185
185
compoundBuilder . BuildDynamicCompound ( out var clampChildren , out var clampInertia , out var clampCenter ) ;
186
186
compoundBuilder . Reset ( ) ;
0 commit comments