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


C# CollisionObject.ToString方法代码示例

本文整理汇总了C#中CollisionObject.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# CollisionObject.ToString方法的具体用法?C# CollisionObject.ToString怎么用?C# CollisionObject.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CollisionObject的用法示例。


在下文中一共展示了CollisionObject.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateUnityRigidBodyProxy

 /*
 public GameObject CreateUnityRigidBodyProxy(BulletSharp.RigidBody body) {
     CollisionShape cs = body.CollisionShape;
     if (cs is BoxShape) {
         BoxShape bxcs = cs as BoxShape;
         GameObject cube = Instantiate<GameObject>(cubePrefab);
         BulletSharp.Math.Vector3 s = bxcs.HalfExtentsWithMargin;
         MeshRenderer mr = cube.GetComponentInChildren<MeshRenderer>();
         mr.transform.localScale = s.ToUnity() * 2f;
         Matrix4x4 m = body.WorldTransform.ToUnity();
         cube.transform.position = BSExtensionMethods.ExtractTranslationFromMatrix(ref m);
         cube.transform.rotation = BSExtensionMethods.ExtractRotationFromMatrix(ref m);
         cube.transform.localScale = BSExtensionMethods.ExtractScaleFromMatrix(ref m);
         BulletRigidBodyProxy p = cube.GetComponent<BulletRigidBodyProxy>();
         p.target = body;
         return p.gameObject;
     } else {
         Debug.LogError("Unknown collision shape. " + cs);
     }
     return null;
 }
 */
 public GameObject CreateUnityCollisionObjectProxy(CollisionObject body)
 {
     GameObject go = new GameObject(body.ToString());
     MeshFilter mf = go.AddComponent<MeshFilter>();
     Mesh m = mf.mesh;
     MeshFactory2.CreateShape(body.CollisionShape, m);
     MeshRenderer mr = go.AddComponent<MeshRenderer>();
     mr.sharedMaterial = mat;
     if (body.UserObject != null && body.UserObject.Equals("Ground")) {
         mr.sharedMaterial = groundMat;
     }
     BulletRigidBodyProxy rbp = go.AddComponent<BulletRigidBodyProxy>();
     rbp.target = body;
     return go;
 }
开发者ID:RatherGood1,项目名称:BulletSharpUnity3d,代码行数:37,代码来源:BulletExampleRunner.cs


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