本文整理汇总了C#中PhysicsSimulator类的典型用法代码示例。如果您正苦于以下问题:C# PhysicsSimulator类的具体用法?C# PhysicsSimulator怎么用?C# PhysicsSimulator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PhysicsSimulator类属于命名空间,在下文中一共展示了PhysicsSimulator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateAngleSpring
public AngleSpring CreateAngleSpring(PhysicsSimulator physicsSimulator, Body body1, Body body2,
float springConstant, float dampingConstant)
{
AngleSpring angleSpring = CreateAngleSpring(body1, body2, springConstant, dampingConstant);
physicsSimulator.Add(angleSpring);
return angleSpring;
}
示例2: CreateAngleLimitJoint
public AngleLimitJoint CreateAngleLimitJoint(PhysicsSimulator physicsSimulator, Body body1, Body body2,
float min, float max)
{
AngleLimitJoint angleLimitJoint = CreateAngleLimitJoint(body1, body2, min, max);
physicsSimulator.Add(angleLimitJoint);
return angleLimitJoint;
}
示例3: CreateRevoluteJoint
public RevoluteJoint CreateRevoluteJoint(PhysicsSimulator physicsSimulator, Body body1, Body body2,
Vector2 initialAnchorPosition)
{
RevoluteJoint revoluteJoint = CreateRevoluteJoint(body1, body2, initialAnchorPosition);
physicsSimulator.Add(revoluteJoint);
return revoluteJoint;
}
示例4: CreateAngleJoint
public AngleJoint CreateAngleJoint(PhysicsSimulator physicsSimulator, Body body1, Body body2, float softness,
float biasFactor)
{
AngleJoint angleJoint = CreateAngleJoint(body1, body2, softness, biasFactor);
physicsSimulator.Add(angleJoint);
return angleJoint;
}
示例5: CreateFixedAngleSpring
public FixedAngleSpring CreateFixedAngleSpring(PhysicsSimulator physicsSimulator, Body body,
float springConstant, float dampningConstant)
{
FixedAngleSpring fixedAngleSpring = CreateFixedAngleSpring(body, springConstant, dampningConstant);
physicsSimulator.Add(fixedAngleSpring);
return fixedAngleSpring;
}
示例6: CreatePinJoint
public PinJoint CreatePinJoint(PhysicsSimulator physicsSimulator, Body body1, Vector2 anchor1, Body body2,
Vector2 anchor2)
{
PinJoint pinJoint = CreatePinJoint(body1, anchor1, body2, anchor2);
physicsSimulator.Add(pinJoint);
return pinJoint;
}
示例7: CreateChain
/// <summary>
/// Creates a chain from start to end points containing the specified number of links.
/// </summary>
/// <param name="physicsSimulator"><see cref="PhysicsSimulator"/> to add the chain to.</param>
/// <param name="start">Starting point of the chain.</param>
/// <param name="end">Ending point of the chain.</param>
/// <param name="links">Number of links desired in the chain.</param>
/// <param name="height">Height of each link.</param>
/// <param name="mass">Mass of each link.</param>
/// <param name="collisionGroup">Collision group for the chain.</param>
/// <param name="type">The joint/spring type.</param>
/// <returns>Path</returns>
public Path CreateChain(PhysicsSimulator physicsSimulator, Vector2 start, Vector2 end, int links, float height,
float mass, int collisionGroup, LinkType type)
{
Path p = CreateChain(start, end, (Vector2.Distance(start, end) / links), height, mass, collisionGroup, type);
p.AddToPhysicsSimulator(physicsSimulator);
return p;
}
示例8: SpatialHashCollider
public SpatialHashCollider(PhysicsSimulator physicsSimulator, float cellSize, int hashCapacity)
{
_physicsSimulator = physicsSimulator;
_hash = new Dictionary<long, List<Geom>>(hashCapacity);
_keysToRemove = new List<long>(hashCapacity);
_filter = new Dictionary<long, object>();
_cellSize = cellSize;
_cellSizeInv = 1 / cellSize;
}
示例9: CreateFixedLinearSpring
public FixedLinearSpring CreateFixedLinearSpring(PhysicsSimulator physicsSimulator, Body body,
Vector2 bodyAttachPoint, Vector2 worldAttachPoint,
float springConstant, float dampingConstant)
{
FixedLinearSpring fixedSpring = CreateFixedLinearSpring(body, bodyAttachPoint, worldAttachPoint,
springConstant, dampingConstant);
physicsSimulator.Add(fixedSpring);
return fixedSpring;
}
示例10: CreateLinearSpring
public LinearSpring CreateLinearSpring(PhysicsSimulator physicsSimulator, Body body1, Vector2 attachPoint1,
Body body2, Vector2 attachPoint2, float springConstant,
float dampingConstant)
{
LinearSpring linearSpring = CreateLinearSpring(body1, attachPoint1, body2, attachPoint2, springConstant,
dampingConstant);
physicsSimulator.Add(linearSpring);
return linearSpring;
}
示例11: GravityController
/// <summary>
/// Initializes the GravityController.
/// </summary>
/// <param name="simulator">The physicsSimulator used by this controller.</param>
/// <param name="points">The points that you want to generate gravity.</param>
/// <param name="strength">the strength of gravity (the gravity strength when two bodies are on the same spot)</param>
/// <param name="radius">the maximum distance that can be between 2 bodies before it will stop trying to apply gravity between them.</param>
public GravityController(PhysicsSimulator simulator, List<Vector2> points, float strength, float radius)
{
_simulator = simulator;
_strength = strength;
if (_gravityType == GravityType.DistanceSquared)
_strength *= 100;
_radius = radius;
_pointList = points;
}
示例12: GravityController
/// <summary>
/// Initializes the GravityController.
/// </summary>
/// <param name="simulator">The physicsSimulator used by this controller.</param>
/// <param name="bodies">The bodies that you want to generate gravity.</param>
/// <param name="points">The points that you want to generate gravity.</param>
/// <param name="strength">the strength of gravity (the gravity strength when two bodies are on the same spot)</param>
/// <param name="radius">the maximum distance that can be between 2 bodies before it will stop trying to apply gravity between them.</param>
public GravityController(PhysicsSimulator simulator, List<Body> bodies, List<Vector2> points, float strength, float radius)
{
GravityType = GravityType.Linear;
_simulator = simulator;
_strength = strength;
if (GravityType == GravityType.DistanceSquared)
_strength *= 100;
_radius = radius;
PointList = points;
BodyList = bodies;
}
示例13: InactivityController
public InactivityController(PhysicsSimulator physicsSimulator)
{
_physicsSimulator = physicsSimulator;
}
示例14: CreateTrack
/// <summary>
/// Creates a track.
/// </summary>
/// <param name="physicsSimulator">The physics simulator.</param>
/// <param name="points">The points.</param>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="mass">The mass.</param>
/// <param name="endless">if set to <c>true</c> [endless].</param>
/// <param name="collisionGroup">Collision group for the chain.</param>
/// <param name="type">The joint/spring type.</param>
/// <returns></returns>
public Path CreateTrack(PhysicsSimulator physicsSimulator, Vertices points, float width, float height,
float mass, bool endless, int collisionGroup, LinkType type)
{
Path path = CreateTrack(points, width, height, mass, endless, collisionGroup, type);
path.AddToPhysicsSimulator(physicsSimulator);
return path;
}
示例15: CreateGravityController
/// <summary>
/// Creates a gravity controller and adds it to the physics simulator.
/// </summary>
/// <param name="simulator">the physicsSimulator used by this controller.</param>
/// <param name="points">The points you want to generate gravity.</param>
/// <param name="strength">the maximum strength of gravity (the gravity strength when two bodies are on the same spot)</param>
/// <param name="radius">the maximum distance that can be between 2 bodies before it will stop trying to apply gravity between them.</param>
/// <returns></returns>
public GravityController CreateGravityController(PhysicsSimulator simulator, List<Vector2> points, float strength, float radius)
{
GravityController gravityController = new GravityController(simulator, points, strength, radius);
simulator.Add(gravityController);
return gravityController;
}