本文整理汇总了C#中BEPUphysics.Entities.Entity类的典型用法代码示例。如果您正苦于以下问题:C# Entity类的具体用法?C# Entity怎么用?C# Entity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Entity类属于BEPUphysics.Entities命名空间,在下文中一共展示了Entity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: FixedOffsetCameraControlScheme
public FixedOffsetCameraControlScheme(Entity entity, Camera camera, DemosGame game)
: base(camera, game)
{
Entity = entity;
UseCameraSmoothing = true;
CameraOffset = new Vector3(0, 0.7f, 0);
}
开发者ID:Anomalous-Software,项目名称:BEPUPhysics,代码行数:7,代码来源:FixedOffsetCameraControlScheme.cs
示例2: DisplayEntityModel
/// <summary>
/// Constructs a new display model.
/// </summary>
/// <param name="entity">Entity to follow.</param>
/// <param name="model">Model to draw on the entity.</param>
/// <param name="modelDrawer">Model drawer to use.</param>
public DisplayEntityModel(Entity entity, Model model, ModelDrawer modelDrawer)
: base(modelDrawer)
{
OffsetTransform = Matrix.Identity;
Entity = entity;
Model = model;
}
开发者ID:gpforde,项目名称:GPBrakes,代码行数:13,代码来源:DisplayEntityModel.cs
示例3: Thruster
/// <summary>
/// Constructs a thruster originating at the given position, pushing in the given direction.
/// </summary>
/// <param name="targetEntity">Entity that the force will be applied to.</param>
/// <param name="pos">Origin of the force.</param>
/// <param name="dir">Direction of the force.</param>
/// <param name="time">Total lifespan of the force. A lifespan of zero is infinite.</param>
public Thruster(Entity targetEntity, Vector3 pos, Vector3 dir, float time)
{
Target = targetEntity;
Position = pos;
Direction = dir;
LifeSpan = time;
}
开发者ID:Raverenx,项目名称:GameEngine,代码行数:14,代码来源:Thruster.cs
示例4: FishInABarrelDemo
/// <summary>
/// Constructs a new demo.
/// </summary>
/// <param name="game">Game owning this demo.</param>
public FishInABarrelDemo(DemosGame game)
: base(game)
{
game.Camera.Position = new Vector3(0, 7, 30);
var detector = new Box(new Vector3(0, 0, 0), 1.5f, 1.5f, 1.5f);
detector.CollisionInformation.CollisionRules.Personal = CollisionRule.NoSolver;
var acceptedTriggerEntity = new Box(new Vector3(5, 0, 0), 1.6f, .7f, .4f, 1);
acceptedTrigger = acceptedTriggerEntity.CollisionInformation;
detector.Tag = "noDisplayObject";
acceptedTriggerEntity.Tag = "noDisplayObject";
Space.Add(detector);
Space.Add(acceptedTriggerEntity);
var fish = game.Content.Load<Model>("fish");
game.ModelDrawer.Add(new DisplayEntityModel(acceptedTriggerEntity, fish, game.ModelDrawer));
var barrelAndPlatform = game.Content.Load<Model>("barrelAndPlatform");
Vector3[] staticTriangleVertices;
int[] staticTriangleIndices;
ModelDataExtractor.GetVerticesAndIndicesFromModel(barrelAndPlatform, out staticTriangleVertices, out staticTriangleIndices);
//Note that the final 'margin' parameter is optional, but can be used to specify a collision margin on triangles in the static triangle group.
var fishDepositoryGroup = new StaticMesh(staticTriangleVertices, staticTriangleIndices);
CollisionRules.AddRule(fishDepositoryGroup, detector, CollisionRule.NoBroadPhase);
Space.Add(fishDepositoryGroup);
game.ModelDrawer.Add(fishDepositoryGroup);
movedBox = new Box(new Vector3(-4, 5, 0), 1, 1, 1, 1);
detector.Space.Add(movedBox);
detector.CollisionInformation.Events.InitialCollisionDetected += InitialCollisionDetected;
detector.CollisionInformation.Events.CollisionEnded += CollisionEnded;
}
开发者ID:EugenyN,项目名称:BEPUphysicsMG,代码行数:38,代码来源:FishInABarrelDemo.cs
示例5: SwivelHingeJoint
/// <summary>
/// Constructs a new constraint which restricts three degrees of linear freedom and one degree of angular freedom between two entities.
/// </summary>
/// <param name="connectionA">First entity of the constraint pair.</param>
/// <param name="connectionB">Second entity of the constraint pair.</param>
/// <param name="anchor">Point around which both entities rotate.</param>
/// <param name="hingeAxis">Axis of allowed rotation in world space to be attached to connectionA. Will be kept perpendicular with the twist axis.</param>
public SwivelHingeJoint(Entity connectionA, Entity connectionB, ref Vector3 anchor, ref Vector3 hingeAxis)
{
if (connectionA == null)
connectionA = TwoEntityConstraint.WorldEntity;
if (connectionB == null)
connectionB = TwoEntityConstraint.WorldEntity;
BallSocketJoint = new BallSocketJoint(connectionA, connectionB, ref anchor);
Vector3 tmp;
BallSocketJoint.OffsetB.Invert( out tmp );
AngularJoint = new SwivelHingeAngularJoint(connectionA, connectionB, ref hingeAxis, ref tmp );
HingeLimit = new RevoluteLimit(connectionA, connectionB);
HingeMotor = new RevoluteMotor(connectionA, connectionB, hingeAxis);
TwistLimit = new TwistLimit(connectionA, connectionB, ref BallSocketJoint.worldOffsetA, ref tmp, 0, 0);
TwistMotor = new TwistMotor(connectionA, connectionB, ref BallSocketJoint.worldOffsetA, ref tmp );
HingeLimit.IsActive = false;
HingeMotor.IsActive = false;
TwistLimit.IsActive = false;
TwistMotor.IsActive = false;
//Ensure that the base and test direction is perpendicular to the free axis.
Vector3 baseAxis; anchor.Sub( ref connectionA.position, out baseAxis );
if (baseAxis.LengthSquared() < Toolbox.BigEpsilon) //anchor and connection a in same spot, so try the other way.
connectionB.position.Sub( ref anchor, out baseAxis );
baseAxis.AddScaled( ref hingeAxis, -Vector3.Dot( ref baseAxis, ref hingeAxis) , out baseAxis );
if (baseAxis.LengthSquared() < Toolbox.BigEpsilon)
{
//However, if the free axis is totally aligned (like in an axis constraint), pick another reasonable direction.
Vector3.Cross(ref hingeAxis, ref Vector3.Up, out baseAxis);
if (baseAxis.LengthSquared() < Toolbox.BigEpsilon)
{
Vector3.Cross(ref hingeAxis, ref Vector3.Right, out baseAxis);
}
}
HingeLimit.Basis.SetWorldAxes(ref hingeAxis, ref baseAxis, ref connectionA.orientationMatrix);
HingeMotor.Basis.SetWorldAxes( ref hingeAxis, ref baseAxis, ref connectionA.orientationMatrix);
connectionB.position.Sub( ref anchor, out baseAxis );
baseAxis.AddScaled( ref hingeAxis, -Vector3.Dot(ref baseAxis, ref hingeAxis), out baseAxis );
if (baseAxis.LengthSquared() < Toolbox.BigEpsilon)
{
//However, if the free axis is totally aligned (like in an axis constraint), pick another reasonable direction.
Vector3.Cross(ref hingeAxis, ref Vector3.Up, out baseAxis);
if (baseAxis.LengthSquared() < Toolbox.BigEpsilon)
{
Vector3.Cross(ref hingeAxis, ref Vector3.Right, out baseAxis);
}
}
HingeLimit.TestAxis = baseAxis;
HingeMotor.TestAxis = baseAxis;
Add(BallSocketJoint);
Add(AngularJoint);
Add(HingeLimit);
Add(HingeMotor);
Add(TwistLimit);
Add(TwistMotor);
}
开发者ID:d3x0r,项目名称:Voxelarium,代码行数:65,代码来源:SwivelHingeJoint.cs
示例6: PointOnPlaneJoint
/// <summary>
/// Constructs a new point on plane constraint.
/// </summary>
/// <param name="connectionA">Entity to which the constraint's plane is attached.</param>
/// <param name="connectionB">Entity to which the constraint's point is attached.</param>
/// <param name="planeAnchor">A point on the plane.</param>
/// <param name="normal">Direction, attached to the first connected entity, defining the plane's normal</param>
/// <param name="pointAnchor">The point to constrain to the plane, attached to the second connected object.</param>
public PointOnPlaneJoint(Entity connectionA, Entity connectionB, Vector3 planeAnchor, Vector3 normal, Vector3 pointAnchor)
{
ConnectionA = connectionA;
ConnectionB = connectionB;
PointAnchor = pointAnchor;
PlaneAnchor = planeAnchor;
PlaneNormal = normal;
}
开发者ID:Indiefreaks,项目名称:igf,代码行数:17,代码来源:PointOnPlaneJoint.cs
示例7: SwivelHingeJoint
/// <summary>
/// Constructs a new constraint which restricts three degrees of linear freedom and one degree of angular freedom between two entities.
/// </summary>
/// <param name="connectionA">First entity of the constraint pair.</param>
/// <param name="connectionB">Second entity of the constraint pair.</param>
/// <param name="anchor">Point around which both entities rotate.</param>
/// <param name="hingeAxis">Axis of allowed rotation in world space to be attached to connectionA. Will be kept perpendicular with the twist axis.</param>
public SwivelHingeJoint(Entity connectionA, Entity connectionB, Vector3 anchor, Vector3 hingeAxis)
{
if (connectionA == null)
connectionA = TwoEntityConstraint.WorldEntity;
if (connectionB == null)
connectionB = TwoEntityConstraint.WorldEntity;
BallSocketJoint = new BallSocketJoint(connectionA, connectionB, anchor);
AngularJoint = new SwivelHingeAngularJoint(connectionA, connectionB, hingeAxis, -BallSocketJoint.OffsetB);
HingeLimit = new RevoluteLimit(connectionA, connectionB);
HingeMotor = new RevoluteMotor(connectionA, connectionB, hingeAxis);
TwistLimit = new TwistLimit(connectionA, connectionB, BallSocketJoint.OffsetA, -BallSocketJoint.OffsetB, 0, 0);
TwistMotor = new TwistMotor(connectionA, connectionB, BallSocketJoint.OffsetA, -BallSocketJoint.OffsetB);
HingeLimit.IsActive = false;
HingeMotor.IsActive = false;
TwistLimit.IsActive = false;
TwistMotor.IsActive = false;
//Ensure that the base and test direction is perpendicular to the free axis.
Vector3 baseAxis = anchor - connectionA.position;
if (baseAxis.LengthSquared() < Toolbox.BigEpsilon) //anchor and connection a in same spot, so try the other way.
baseAxis = connectionB.position - anchor;
baseAxis -= Vector3.Dot(baseAxis, hingeAxis) * hingeAxis;
if (baseAxis.LengthSquared() < Toolbox.BigEpsilon)
{
//However, if the free axis is totally aligned (like in an axis constraint), pick another reasonable direction.
baseAxis = Vector3.Cross(hingeAxis, Vector3.Up);
if (baseAxis.LengthSquared() < Toolbox.BigEpsilon)
{
baseAxis = Vector3.Cross(hingeAxis, Vector3.Right);
}
}
HingeLimit.Basis.SetWorldAxes(hingeAxis, baseAxis, connectionA.orientationMatrix);
HingeMotor.Basis.SetWorldAxes(hingeAxis, baseAxis, connectionA.orientationMatrix);
baseAxis = connectionB.position - anchor;
baseAxis -= Vector3.Dot(baseAxis, hingeAxis) * hingeAxis;
if (baseAxis.LengthSquared() < Toolbox.BigEpsilon)
{
//However, if the free axis is totally aligned (like in an axis constraint), pick another reasonable direction.
baseAxis = Vector3.Cross(hingeAxis, Vector3.Up);
if (baseAxis.LengthSquared() < Toolbox.BigEpsilon)
{
baseAxis = Vector3.Cross(hingeAxis, Vector3.Right);
}
}
HingeLimit.TestAxis = baseAxis;
HingeMotor.TestAxis = baseAxis;
Add(BallSocketJoint);
Add(AngularJoint);
Add(HingeLimit);
Add(HingeMotor);
Add(TwistLimit);
Add(TwistMotor);
}
开发者ID:Indiefreaks,项目名称:igf,代码行数:63,代码来源:SwivelHingeJoint.cs
示例8: GetAnchorGuess
private static Vector3 GetAnchorGuess(Entity connectionA, Entity connectionB)
{
var anchor = new Vector3();
if (connectionA != null)
anchor += connectionA.position;
if (connectionB != null)
anchor += connectionB.position;
if (connectionA != null && connectionB != null)
anchor *= 0.5f;
return anchor;
}
开发者ID:EugenyN,项目名称:BEPUphysicsMG,代码行数:11,代码来源:WeldJoint.cs
示例9: WeldJoint
/// <summary>
/// Constructs a new constraint which restricts the linear and angular motion between two entities.
/// </summary>
/// <param name="connectionA">First entity of the constraint pair.</param>
/// <param name="connectionB">Second entity of the constraint pair.</param>
/// <param name="anchor">The location of the weld.</param>
public WeldJoint(Entity connectionA, Entity connectionB, Vector3 anchor)
{
if (connectionA == null)
connectionA = TwoEntityConstraint.WorldEntity;
if (connectionB == null)
connectionB = TwoEntityConstraint.WorldEntity;
BallSocketJoint = new BallSocketJoint(connectionA, connectionB, anchor);
NoRotationJoint = new NoRotationJoint(connectionA, connectionB);
Add(BallSocketJoint);
Add(NoRotationJoint);
}
开发者ID:EugenyN,项目名称:BEPUphysicsMG,代码行数:17,代码来源:WeldJoint.cs
示例10: WeldJoint
/// <summary>
/// Constructs a new constraint which restricts the linear and angular motion between two entities.
/// </summary>
/// <param name="connectionA">First entity of the constraint pair.</param>
/// <param name="connectionB">Second entity of the constraint pair.</param>
public WeldJoint(Entity connectionA, Entity connectionB)
{
if (connectionA == null)
connectionA = TwoEntityConstraint.WorldEntity;
if (connectionB == null)
connectionB = TwoEntityConstraint.WorldEntity;
BallSocketJoint = new BallSocketJoint(connectionA, connectionB, (connectionA.position + connectionB.position) * .5f);
NoRotationJoint = new NoRotationJoint(connectionA, connectionB);
Add(BallSocketJoint);
Add(NoRotationJoint);
}
开发者ID:arindamGithub,项目名称:Lemma,代码行数:16,代码来源:WeldJoint.cs
示例11: GetAnchorGuess
private static Vector3 GetAnchorGuess(Entity connectionA, Entity connectionB)
{
var anchor = new Vector3();
if (connectionA != null)
anchor.Add( ref connectionA.position, out anchor );
if (connectionB != null)
anchor.Add( ref connectionB.position, out anchor );
if (connectionA != null && connectionB != null)
anchor.Mult( 0.5f, out anchor );
return anchor;
}
开发者ID:d3x0r,项目名称:Voxelarium,代码行数:11,代码来源:WeldJoint.cs
示例12: WeldJoint
/// <summary>
/// Constructs a new constraint which restricts the linear and angular motion between two entities.
/// Uses the average of the two entity positions for the anchor.
/// </summary>
/// <param name="connectionA">First entity of the constraint pair.</param>
/// <param name="connectionB">Second entity of the constraint pair.</param>
public WeldJoint(Entity connectionA, Entity connectionB)
{
if( connectionA == null )
connectionA = TwoEntityConstraint.WorldEntity;
if( connectionB == null )
connectionB = TwoEntityConstraint.WorldEntity;
Vector3 anchor; GetAnchorGuess( connectionA, connectionB, out anchor );
BallSocketJoint = new BallSocketJoint( connectionA, connectionB, ref anchor );
NoRotationJoint = new NoRotationJoint( connectionA, connectionB );
Add( BallSocketJoint );
Add( NoRotationJoint );
}
开发者ID:d3x0r,项目名称:Voxelarium,代码行数:18,代码来源:WeldJoint.cs
示例13: RevoluteJoint
/// <summary>
/// Constructs a new constraint which restricts three degrees of linear freedom and two degrees of angular freedom between two entities.
/// </summary>
/// <param name="connectionA">First entity of the constraint pair.</param>
/// <param name="connectionB">Second entity of the constraint pair.</param>
/// <param name="anchor">Point around which both entities rotate.</param>
/// <param name="freeAxis">Axis around which the hinge can rotate.</param>
public RevoluteJoint(Entity connectionA, Entity connectionB, System.Numerics.Vector3 anchor, System.Numerics.Vector3 freeAxis)
{
if (connectionA == null)
connectionA = TwoEntityConstraint.WorldEntity;
if (connectionB == null)
connectionB = TwoEntityConstraint.WorldEntity;
BallSocketJoint = new BallSocketJoint(connectionA, connectionB, anchor);
AngularJoint = new RevoluteAngularJoint(connectionA, connectionB, freeAxis);
Limit = new RevoluteLimit(connectionA, connectionB);
Motor = new RevoluteMotor(connectionA, connectionB, freeAxis);
Limit.IsActive = false;
Motor.IsActive = false;
//Ensure that the base and test direction is perpendicular to the free axis.
System.Numerics.Vector3 baseAxis = anchor - connectionA.position;
if (baseAxis.LengthSquared() < Toolbox.BigEpsilon) //anchor and connection a in same spot, so try the other way.
baseAxis = connectionB.position - anchor;
baseAxis -= Vector3Ex.Dot(baseAxis, freeAxis) * freeAxis;
if (baseAxis.LengthSquared() < Toolbox.BigEpsilon)
{
//However, if the free axis is totally aligned (like in an axis constraint), pick another reasonable direction.
baseAxis = System.Numerics.Vector3.Cross(freeAxis, Vector3Ex.Up);
if (baseAxis.LengthSquared() < Toolbox.BigEpsilon)
{
baseAxis = System.Numerics.Vector3.Cross(freeAxis, Vector3Ex.Right);
}
}
Limit.Basis.SetWorldAxes(freeAxis, baseAxis, connectionA.orientationMatrix);
Motor.Basis.SetWorldAxes(freeAxis, baseAxis, connectionA.orientationMatrix);
baseAxis = connectionB.position - anchor;
baseAxis -= Vector3Ex.Dot(baseAxis, freeAxis) * freeAxis;
if (baseAxis.LengthSquared() < Toolbox.BigEpsilon)
{
//However, if the free axis is totally aligned (like in an axis constraint), pick another reasonable direction.
baseAxis = System.Numerics.Vector3.Cross(freeAxis, Vector3Ex.Up);
if (baseAxis.LengthSquared() < Toolbox.BigEpsilon)
{
baseAxis = System.Numerics.Vector3.Cross(freeAxis, Vector3Ex.Right);
}
}
Limit.TestAxis = baseAxis;
Motor.TestAxis = baseAxis;
Add(BallSocketJoint);
Add(AngularJoint);
Add(Limit);
Add(Motor);
}
开发者ID:Raverenx,项目名称:GameEngine,代码行数:56,代码来源:RevoluteJoint.cs
示例14: CalculateImpulse
/// <summary>
/// Calculates the impulse to apply to the center of mass of physically simulated bodies within the field.
/// </summary>
/// <param name="e">Target of the impulse.</param>
/// <param name="dt">Time since the last frame in simulation seconds.</param>
/// <param name="impulse">Force to apply at the given position.</param>
protected override void CalculateImpulse(Entity e, float dt, out Vector3 impulse)
{
if (MaximumPushSpeed > 0)
{
//Current velocity along the tangent direction.
float dot = Vector3.Dot(e.LinearVelocity, forceDirection);
//Compute the velocity difference between the current and the maximum
dot = MaximumPushSpeed - dot;
//Compute the force needed to reach the maximum, but clamp it to the amount of force that the field can apply
//Also, don't apply a force that would slow an object down.
dot = MathHelper.Clamp(dot * e.Mass, 0, forceMagnitude * dt);
Vector3.Multiply(ref forceDirection, dot, out impulse);
}
else
impulse = Force * dt;
}
开发者ID:Anomalous-Software,项目名称:BEPUPhysics,代码行数:22,代码来源:PushField.cs
示例15: EntityModel
/// <summary>
/// Creates a new EntityModel.
/// </summary>
/// <param name="entity">Entity to attach the graphical representation to.</param>
/// <param name="model">Graphical representation to use for the entity.</param>
/// <param name="transform">Base transformation to apply to the model before moving to the entity.</param>
/// <param name="game">Game to which this component will belong.</param>
public EntityModel(Entity entity, Model model, Matrix transform, Game game, Player player)
: base(game)
{
this.entity = entity;
this.model = model;
Transform = transform;
Player = player;
//Collect any bone transformations in the model itself.
//The default cube model doesn't have any, but this allows the EntityModel to work with more complicated shapes.
boneTransforms = new Matrix[model.Bones.Count];
foreach (var effect in model.Meshes.SelectMany(mesh => mesh.Effects).Cast<BasicEffect>())
{
effect.EnableDefaultLighting();
}
}
开发者ID:PaTraVis,项目名称:NewHorizons,代码行数:23,代码来源:EntityModel.cs
示例16: DetectorVolumeDemo
/// <summary>
/// Constructs a new demo.
/// </summary>
/// <param name="game">Game owning this demo.</param>
public DetectorVolumeDemo(DemosGame game)
: base(game)
{
var model = game.Content.Load<Model>("tube");
Vector3[] modelVertices;
int[] modelIndices;
ModelDataExtractor.GetVerticesAndIndicesFromModel(model, out modelVertices, out modelIndices);
detectorVolume = new DetectorVolume(new TriangleMesh(new StaticMeshData(modelVertices, modelIndices)));
Space.Add(detectorVolume);
game.ModelDrawer.Add(detectorVolume.TriangleMesh);
//The detector volume works on all of the entity types:
//Convexes!
testEntity = new Box(new Vector3(0, -10, 0), 1, 1, 1);
//Compounds!
//var bodies = new List<CompoundShapeEntry>
//{
// new CompoundShapeEntry(new SphereShape(.5f), new Vector3(0, -8.2f, 0), 1),
// new CompoundShapeEntry(new SphereShape(.5f), new Vector3(0, -9f, 0), 1),
// new CompoundShapeEntry(new SphereShape(.5f), new Vector3(0, -9.8f, 0), 1)
//};
//testEntity = new CompoundBody(bodies);
//Mobile meshes!
//model = game.Content.Load<Model>("tube");
//TriangleMesh.GetVerticesAndIndicesFromModel(model, out modelVertices, out modelIndices);
//testEntity = new MobileMesh(modelVertices, modelIndices, new AffineTransform(new Vector3(.2f, .2f, .2f), Quaternion.Identity, new Vector3(0, -10, 0)), MobileMeshSolidity.Solid);
testEntity.Tag = "noDisplayObject";
displayBox = game.ModelDrawer.Add(testEntity);
SetColor(0);
game.ModelDrawer.IsWireframe = true;
testEntity.LinearVelocity = new Vector3(0, 1, 0);
Space.Add(testEntity);
//The color of the entity will change based upon events.
//The events don't pay attention to the causing events, so you can toss a ball through the volume to recolor the entity.
detectorVolume.EntityBeganTouching += BeganTouching;
detectorVolume.EntityStoppedTouching += StoppedTouching;
detectorVolume.VolumeBeganContainingEntity += BeganContaining;
detectorVolume.VolumeStoppedContainingEntity += StoppedContaining;
game.Camera.Position = new Vector3(0, 0, 22);
Space.ForceUpdater.Gravity = new Vector3();
}
开发者ID:EugenyN,项目名称:BEPUphysicsMG,代码行数:51,代码来源:DetectorVolumeDemo.cs
示例17: LineSliderJoint
/// <summary>
/// Constructs a new constraint which restricts two degrees of linear freedom and two degrees of angular freedom between two entities.
/// </summary>
/// <param name="connectionA">First entity of the constraint pair.</param>
/// <param name="connectionB">Second entity of the constraint pair.</param>
/// <param name="lineAnchor">Location of the anchor for the line to be attached to connectionA in world space.</param>
/// <param name="lineDirection">Axis in world space to be attached to connectionA along which connectionB can move and rotate.</param>
/// <param name="pointAnchor">Location of the anchor for the point to be attached to connectionB in world space.</param>
public LineSliderJoint(Entity connectionA, Entity connectionB, System.Numerics.Vector3 lineAnchor, System.Numerics.Vector3 lineDirection, System.Numerics.Vector3 pointAnchor)
{
if (connectionA == null)
connectionA = TwoEntityConstraint.WorldEntity;
if (connectionB == null)
connectionB = TwoEntityConstraint.WorldEntity;
PointOnLineJoint = new PointOnLineJoint(connectionA, connectionB, lineAnchor, lineDirection, pointAnchor);
AngularJoint = new RevoluteAngularJoint(connectionA, connectionB, lineDirection);
Limit = new LinearAxisLimit(connectionA, connectionB, lineAnchor, pointAnchor, lineDirection, 0, 0);
Motor = new LinearAxisMotor(connectionA, connectionB, lineAnchor, pointAnchor, lineDirection);
Limit.IsActive = false;
Motor.IsActive = false;
Add(PointOnLineJoint);
Add(AngularJoint);
Add(Limit);
Add(Motor);
}
开发者ID:Raverenx,项目名称:GameEngine,代码行数:25,代码来源:LineSliderJoint.cs
示例18: PrismaticJoint
/// <summary>
/// Constructs a new constraint which restricts two degrees of linear freedom and all three degrees of angular freedom.
/// </summary>
/// <param name="connectionA">First entity of the constraint pair.</param>
/// <param name="connectionB">Second entity of the constraint pair.</param>
/// <param name="lineAnchor">Location of the anchor for the line to be attached to connectionA in world space.</param>
/// <param name="lineDirection">Axis in world space to be attached to connectionA along which connectionB can move.</param>
/// <param name="pointAnchor">Location of the anchor for the point to be attached to connectionB in world space.</param>
public PrismaticJoint(Entity connectionA, Entity connectionB, Vector3 lineAnchor, Vector3 lineDirection, Vector3 pointAnchor)
{
if (connectionA == null)
connectionA = TwoEntityConstraint.WorldEntity;
if (connectionB == null)
connectionB = TwoEntityConstraint.WorldEntity;
PointOnLineJoint = new PointOnLineJoint(connectionA, connectionB, lineAnchor, lineDirection, pointAnchor);
AngularJoint = new NoRotationJoint(connectionA, connectionB);
Limit = new LinearAxisLimit(connectionA, connectionB, lineAnchor, pointAnchor, lineDirection, 0, 0);
Motor = new LinearAxisMotor(connectionA, connectionB, lineAnchor, pointAnchor, lineDirection);
Limit.IsActive = false;
Motor.IsActive = false;
Add(PointOnLineJoint);
Add(AngularJoint);
Add(Limit);
Add(Motor);
}
开发者ID:EugenyN,项目名称:BEPUphysicsMG,代码行数:25,代码来源:PrismaticJoint.cs
示例19: EntityModel
/// <summary>
/// Creates a new EntityModel.
/// </summary>
/// <param name="entity">Entity to attach the graphical representation to.</param>
/// <param name="model">Graphical representation to use for the entity.</param>
/// <param name="transform">Base transformation to apply to the model before moving to the entity.</param>
/// <param name="game">Game to which this component will belong.</param>
public EntityModel(Entity entity, Model model, Matrix transform, Game game, Effect effect)
: base(game)
{
this.entity = entity;
this.model = model;
this.Transform = transform;
//Go through each mesh and assign pre-made effects
for (int i = 0; i < model.Meshes.Count; i++)
{
this.effect.Add(model.Meshes[i].Effects[0]);
}
//Collect any bone transformations in the model itself.
//The default cube model doesn't have any, but this allows the EntityModel to work with more complicated shapes.
boneTransforms = new Matrix[model.Bones.Count];
}
开发者ID:JMarple,项目名称:MicrosoftImagineCup2013,代码行数:24,代码来源:EntityModel.cs
示例20: UniversalJoint
/// <summary>
/// Constructs a new constraint which restricts three degrees of linear freedom and one degree of twisting angular freedom between two entities.
/// </summary>
/// <param name="connectionA">First entity of the constraint pair.</param>
/// <param name="connectionB">Second entity of the constraint pair.</param>
/// <param name="anchor">Point around which both entities rotate in world space.</param>
public UniversalJoint(Entity connectionA, Entity connectionB, Vector3 anchor)
{
if (connectionA == null)
connectionA = TwoEntityConstraint.WorldEntity;
if (connectionB == null)
connectionB = TwoEntityConstraint.WorldEntity;
BallSocketJoint = new BallSocketJoint(connectionA, connectionB, anchor);
TwistJoint = new TwistJoint(connectionA, connectionB, BallSocketJoint.OffsetA, -BallSocketJoint.OffsetB);
Limit = new TwistLimit(connectionA, connectionB, BallSocketJoint.OffsetA, -BallSocketJoint.OffsetB, 0, 0);
Motor = new TwistMotor(connectionA, connectionB, BallSocketJoint.OffsetA, -BallSocketJoint.OffsetB);
Limit.IsActive = false;
Motor.IsActive = false;
Add(BallSocketJoint);
Add(TwistJoint);
Add(Limit);
Add(Motor);
}
开发者ID:Anomalous-Software,项目名称:BEPUPhysics,代码行数:23,代码来源:UniversalJoint.cs
注:本文中的BEPUphysics.Entities.Entity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论