本文整理汇总了C#中Bullet.AddRigidBody方法的典型用法代码示例。如果您正苦于以下问题:C# Bullet.AddRigidBody方法的具体用法?C# Bullet.AddRigidBody怎么用?C# Bullet.AddRigidBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bullet
的用法示例。
在下文中一共展示了Bullet.AddRigidBody方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
Bullet bullet = new Bullet();
CollisionShapeHandle s_handle = bullet.CreateSphere(1);
RigidBody body = new RigidBody(1, s_handle);
float [] position = new float[3];
position[0] = 1.0f; position[1] = 1.1f; position[2] = 1.2f;
body.SetPosition(position);
body.SetOrientation(0.1f, 0.2f, 0.3f);
bullet.AddRigidBody(body);
System.Console.WriteLine("Original Position (" + position[0] + ", " + position[1] + ", " + position[2] + ")");
float[] new_position = new float[3];
for (int i = 0; i < 10; i++)
{
bullet.StepSimulation(0.1f);
System.Console.WriteLine("StepSimulation " + 0.1);
body.GetPosition(new_position);
System.Console.WriteLine("New Position (" + new_position[0] + ", " + new_position[1] + ", " + new_position[2] + ")");
}
float[] matrix = new float[16];
body.GetOpenGLMatrix(matrix);
System.Console.WriteLine("GetOpenGLMatrix (" +
matrix[0] + ", " + matrix[1] + ", " + matrix[2] + ", " + matrix[3] + ", " +
matrix[4] + ", " + matrix[5] + ", " + matrix[6] + ", " + matrix[7] + ", " +
matrix[8] + ", " + matrix[9] + ", " + matrix[10] + ", " + matrix[11] + ", " +
matrix[12] + ", " + matrix[13] + ", " + matrix[14] + ", " + matrix[15] + ")"
);
float[] quot = new float[4];
body.GetOrientation(quot);
System.Console.WriteLine("GetOrientation (" + quot[0] + ", " + quot[1] + ", " + quot[2] + ", " + quot[3] + ")");
}