当前位置: 首页>>代码示例>>C#>>正文


C# Bullet.AddRigidBody方法代码示例

本文整理汇总了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] + ")");
        }
开发者ID:Belxjander,项目名称:Asuna,代码行数:36,代码来源:Program.cs


注:本文中的Bullet.AddRigidBody方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。