本文整理汇总了C#中Vector3.AsPhysX方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3.AsPhysX方法的具体用法?C# Vector3.AsPhysX怎么用?C# Vector3.AsPhysX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector3
的用法示例。
在下文中一共展示了Vector3.AsPhysX方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PhysxPhysicWorld
public PhysxPhysicWorld(Vector3 gravity, bool connectToRemoteDebugger = false)
{
physix = new PhysX.Physics(new ErrorCallbackImp(), true);
var sceneDesc = new SceneDesc()
{
Gravity = gravity.AsPhysX()
};
scene = physix.CreateScene(sceneDesc);
this.scene.SetVisualizationParameter(VisualizationParameter.Scale, 1.0f);
this.scene.SetVisualizationParameter(VisualizationParameter.CollisionShapes, true);
this.scene.SetVisualizationParameter(VisualizationParameter.JointLocalFrames, true);
this.scene.SetVisualizationParameter(VisualizationParameter.JointLimits, true);
this.scene.SetVisualizationParameter(VisualizationParameter.ParticleSystemPosition, true);
this.scene.SetVisualizationParameter(VisualizationParameter.ActorAxes, true);
// Connect to the remote debugger if it's there
if (connectToRemoteDebugger)
{
physix.ConnectToRemoteDebugger("localhost");
}
objs = new List<IPhysicObject>();
ctns = new List<IPhysicConstraint>();
cooking = physix.CreateCooking();
}
示例2: PhysxCapsuleCharacterObject
public PhysxCapsuleCharacterObject(CapsuleControllerDescription CapsuleControllerDescription,Vector3 position, Matrix rotation,Vector3 scale)
{
this.scale = scale;
this.CapsuleControllerDescription = CapsuleControllerDescription;
this.CapsuleControllerDescription.Position = position.AsPhysX();
CapsuleControllerDescription.Height *= scale.Y;
CapsuleControllerDescription.Radius *= scale.X;
this.rotation = rotation;
}
示例3: PhysxBoxCharacterObject
public PhysxBoxCharacterObject(BoxControllerDescription BoxControllerDescription, Vector3 position, Matrix rotation, Vector3 scale)
{
this.scale = scale;
this.BoxControllerDescription = BoxControllerDescription;
this.BoxControllerDescription.Position = position.AsPhysX();
StillDesign.PhysX.MathPrimitives.Vector3 vec = BoxControllerDescription.Size;
vec.X *= scale.X;
vec.Y *= scale.Y;
vec.Z *= scale.Z;
BoxControllerDescription.Size = vec;
this.rotation = rotation;
}
示例4: LoadContent
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
{
PhysxPhysicWorld PhysxPhysicWorld = World.PhysicWorld as PhysxPhysicWorld;
base.LoadContent(GraphicInfo, factory, contentManager);
int w = 25;
int h = 25;
float hw = w / 2.0f;
float hh = h / 2.0f;
Vector3 p = new Vector3(0, 20, 0);
var grid = VertexGrid.CreateGrid(w, h);
ClothModel ClothModel = new PloobsEngine.Modelo.ClothModel(factory, PhysxPhysicWorld,
new ClothMeshDescription(), grid.Points,grid.TextCoords,grid.Indices, "Textures//meiofio");
var clothDesc = new ClothDescription()
{
Friction = 0.5f,
ClothMesh = ClothModel.ClothMesh,
Flags = ClothFlag.Gravity | ClothFlag.Bending | ClothFlag.CollisionTwoway | ClothFlag.Visualization ,
Thickness = 0.2f,
};
clothDesc.MeshData.AllocatePositions<Vector3>(grid.Points.Length );
clothDesc.MeshData.AllocateIndices<int>(grid.Indices.Length );
clothDesc.MeshData.AllocateNormals<Vector3>(grid.Points.Length );
clothDesc.MeshData.MaximumVertices = grid.Points.Length ;
clothDesc.MeshData.MaximumIndices = grid.Indices.Length ;
clothDesc.MeshData.NumberOfVertices = grid.Points.Length ;
clothDesc.MeshData.NumberOfIndices = grid.Indices.Length ;
PhysxClothObject PhysxClothObject = new PloobsEngine.Physics.PhysxClothObject(clothDesc,
Matrix.CreateTranslation(-hw, 0, -hh) * Matrix.CreateTranslation(p));
ForwardXNABasicShader ForwardXNABasicShader = new PloobsEngine.Material.ForwardXNABasicShader();
ClothMaterial ClothMaterial = new ClothMaterial(ForwardXNABasicShader);
IObject IObject = new PloobsEngine.SceneControl.IObject(ClothMaterial, ClothModel, PhysxClothObject);
World.AddObject(IObject);
// Four corner boxes to hold it in place
var positions = new[]
{
new StillDesign.PhysX.MathPrimitives.Vector3(0, 0, -hh), // Back
new StillDesign.PhysX.MathPrimitives.Vector3(0, 0, hh), // Front
new StillDesign.PhysX.MathPrimitives.Vector3(-hw, 0, 0), // Left
new StillDesign.PhysX.MathPrimitives.Vector3(hw, 0, 0), // Right
};
var sizes = new[]
{
new StillDesign.PhysX.MathPrimitives.Vector3(w, 1, 1), // Back
new StillDesign.PhysX.MathPrimitives.Vector3(w, 1, 1), // Front
new StillDesign.PhysX.MathPrimitives.Vector3(1, 1, h), // Left
new StillDesign.PhysX.MathPrimitives.Vector3(1, 1, h), //Right
};
///pra preender
for (int i = 0; i < 2; i++)
{
var actorDesc = new ActorDescription()
{
GlobalPose = StillDesign.PhysX.MathPrimitives.Matrix.Translation(positions[i] + p.AsPhysX()),
Shapes = { new BoxShapeDescription(sizes[i]) }
};
var actor = PhysxPhysicWorld.Scene.CreateActor(actorDesc);
PhysxClothObject.Cloth.AttachToShape(actor.Shapes.First(), (ClothAttachmentFlag)0);
}
BallThrowPhysx28 BallThrowBullet = new BallThrowPhysx28(this.World, GraphicFactory);
this.AttachCleanUpAble(BallThrowBullet);
this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo));
}
示例5: GetPhysicsObjectsInRange
public override void GetPhysicsObjectsInRange(Vector3 position, float distance, CullerConditionAvaliator<IPhysicObject, SceneControl.IObject> CullerAvaliator, List<IPhysicObject> resp)
{
SphereGeometry SphereGeometry = new PhysX.SphereGeometry(distance);
foreach (var item in scene.OverlapMultiple(SphereGeometry, PhysX.Math.Matrix.Translation(position.AsPhysX())))
{
if (item.UserData is IPhysicObject)
{
IPhysicObject IPhysicObject = item.UserData as IPhysicObject;
if (CullerAvaliator(IPhysicObject, IPhysicObject.ObjectOwner))
{
resp.Add(IPhysicObject);
}
}
}
}
示例6: ApplyImpulse
public override void ApplyImpulse(Vector3 position, Vector3 force)
{
Actor.AddForceAtLocalPosition(force.AsPhysX(), position.AsPhysX());
}