本文整理汇总了C#中PhysX.CreateJoint方法的典型用法代码示例。如果您正苦于以下问题:C# PhysX.CreateJoint方法的具体用法?C# PhysX.CreateJoint怎么用?C# PhysX.CreateJoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhysX
的用法示例。
在下文中一共展示了PhysX.CreateJoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadPhysics
protected override void LoadPhysics(PhysX.Scene scene)
{
var material = scene.Physics.CreateMaterial(0.7f, 0.7f, 0.1f);
var sphereA = scene.Physics.CreateRigidDynamic();
sphereA.CreateShape(new SphereGeometry(1), material);
sphereA.GlobalPose = Matrix4x4.CreateTranslation(0, 30, 0);
scene.AddActor(sphereA);
//
var sphereB = scene.Physics.CreateRigidDynamic();
sphereB.CreateShape(new SphereGeometry(1), material);
sphereB.GlobalPose = Matrix4x4.CreateTranslation(0, 40, 0);
scene.AddActor(sphereB);
//
var sphereC = scene.Physics.CreateRigidDynamic();
sphereC.CreateShape(new SphereGeometry(1), material);
sphereC.GlobalPose = Matrix4x4.CreateTranslation(0, 50, 0);
scene.AddActor(sphereC);
_sphereC = sphereC;
//
var revoluteABJoint = scene.CreateJoint<RevoluteJoint>(sphereA, Matrix4x4.Identity, sphereB, Matrix4x4.Identity);
revoluteABJoint.SetGlobalFrame(new Vector3(0, 35, 0), new Vector3(0, 0, 1));
revoluteABJoint.ConstraintFlag = ConstraintFlag.Visualization;
var revoluteBCJoint = scene.CreateJoint<RevoluteJoint>(sphereB, Matrix4x4.Identity, sphereC, Matrix4x4.Identity);
revoluteBCJoint.SetGlobalFrame(new Vector3(0, 45, 0), new Vector3(0, 0, 1));
revoluteBCJoint.ConstraintFlag = ConstraintFlag.Visualization;
var revoluteAJoint = scene.CreateJoint<RevoluteJoint>(sphereA, Matrix4x4.Identity, null, Matrix4x4.Identity);
revoluteAJoint.SetGlobalFrame(new Vector3(0, 30, 0), new Vector3(0, 0, 1));
revoluteAJoint.ConstraintFlag = ConstraintFlag.Visualization;
}