本文整理汇总了C#中Microsoft.AsPhysX方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.AsPhysX方法的具体用法?C# Microsoft.AsPhysX怎么用?C# Microsoft.AsPhysX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft
的用法示例。
在下文中一共展示了Microsoft.AsPhysX方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PhysxTriangleMesh
public PhysxTriangleMesh(PhysxPhysicWorld PhysxPhysicWorld, IModelo model,Microsoft.Xna.Framework.Matrix localTransformation, Microsoft.Xna.Framework.Matrix worldTransformation, Microsoft.Xna.Framework.Vector3 scale, MaterialDescription MaterialDescription)
{
Microsoft.Xna.Framework.Vector3[] vertices = null;
int[] indices = null;
ExtractData(ref vertices, ref indices, model);
TriangleMeshDesc meshDesc = new TriangleMeshDesc();
Vector3[] points = new Vector3[vertices.Count()];
for (int i = 0; i < vertices.Count(); i++)
{
points[i] = vertices[i].AsPhysX();
}
meshDesc.Points = points;
meshDesc.SetTriangles<int>(indices);
//meshDesc.Triangles = indices;
MemoryStream ms = new MemoryStream();
if(PhysxPhysicWorld.Cooking.CookTriangleMesh(meshDesc,ms)==false)
{
PloobsEngine.Engine.Logger.ActiveLogger.LogMessage("Cant Cook Model",Engine.Logger.LogLevel.FatalError);
}
ms.Position = 0;
TriangleMesh triangleMesh = PhysxPhysicWorld.Physix.CreateTriangleMesh(ms);
staticActor = PhysxPhysicWorld.Physix.CreateRigidStatic(worldTransformation.AsPhysX());
TriangleMeshGeometry TriangleMeshGeometry = new TriangleMeshGeometry(triangleMesh,new MeshScale(scale.AsPhysX(),Quaternion.Identity));
material = PhysxPhysicWorld.Physix.CreateMaterial(MaterialDescription.StaticFriction, MaterialDescription.DynamicFriction, MaterialDescription.Bounciness);
aTriMeshShape = staticActor.CreateShape(TriangleMeshGeometry, material, localTransformation.AsPhysX());
this.Scale = scale;
}
示例2: PhysxStaticActor
public PhysxStaticActor(PhysxPhysicWorld PhysxPhysicWorld ,Geometry geometry, Microsoft.Xna.Framework.Matrix localTransformation, Microsoft.Xna.Framework.Matrix worldTransformation, Microsoft.Xna.Framework.Vector3 scale, MaterialDescription MaterialDescription)
{
staticActor = PhysxPhysicWorld.Physix.CreateRigidStatic(worldTransformation.AsPhysX());
material = PhysxPhysicWorld.Physix.CreateMaterial(MaterialDescription.StaticFriction, MaterialDescription.DynamicFriction, MaterialDescription.Bounciness);
Shape aTriMeshShape = staticActor.CreateShape(geometry, material, localTransformation.AsPhysX());
}