本文整理汇总了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;
}