C# 클래스 Nez.Verlet.DistanceConstraint

maintains a specified distance betweeen two Particles. The stiffness adjusts how rigid or springy the constraint will be.
상속: Constraint
파일 보기 프로젝트 열기: prime31/Nez

공개 프로퍼티들

프로퍼티 타입 설명
restingDistance float
shouldApproximateCollisionsWithPoints bool
stiffness float
tearSensitivity float
totalPointsToApproximateCollisionsWith int

공개 메소드들

메소드 설명
DistanceConstraint ( Particle first, Particle second, float stiffness, float distance = -1 ) : System
create ( Particle a, Particle center, Particle c, float stiffness, float angleInDegrees ) : DistanceConstraint

creates a faux angle constraint by figuring out the required distance from a to c for the given angle

debugRender ( Batcher batcher ) : void
setCollidesWithColliders ( bool collidesWithColliders ) : DistanceConstraint

sets whether this Constraint should collide with standard Colliders

setShouldApproximateCollisionsWithPoints ( bool shouldApproximateCollisionsWithPoints ) : DistanceConstraint

sets whether collisions should be approximated by points. This should be used for Constraints that need to collided on both sides. SAT only works with single sided collisions.

setTearSensitivity ( float tearSensitivity ) : DistanceConstraint

sets the tear sensitivity. if the ratio of the current distance / restingDistance is greater than tearSensitivity the Constaint will be removed

solve ( ) : void

비공개 메소드들

메소드 설명
approximateCollisionsWithPoints ( int collidesWithLayers ) : void
handleCollisions ( int collidesWithLayers ) : void
preparePolygonForCollisionChecks ( Vector2 &midPoint ) : void

메소드 상세

DistanceConstraint() 공개 메소드

public DistanceConstraint ( Particle first, Particle second, float stiffness, float distance = -1 ) : System
first Particle
second Particle
stiffness float
distance float
리턴 System

create() 공개 정적인 메소드

creates a faux angle constraint by figuring out the required distance from a to c for the given angle
public static create ( Particle a, Particle center, Particle c, float stiffness, float angleInDegrees ) : DistanceConstraint
a Particle The alpha component.
center Particle Center.
c Particle C.
stiffness float Stiffness.
angleInDegrees float Angle in degrees.
리턴 DistanceConstraint

debugRender() 공개 메소드

public debugRender ( Batcher batcher ) : void
batcher Batcher
리턴 void

setCollidesWithColliders() 공개 메소드

sets whether this Constraint should collide with standard Colliders
public setCollidesWithColliders ( bool collidesWithColliders ) : DistanceConstraint
collidesWithColliders bool If set to true collides with colliders.
리턴 DistanceConstraint

setShouldApproximateCollisionsWithPoints() 공개 메소드

sets whether collisions should be approximated by points. This should be used for Constraints that need to collided on both sides. SAT only works with single sided collisions.
public setShouldApproximateCollisionsWithPoints ( bool shouldApproximateCollisionsWithPoints ) : DistanceConstraint
shouldApproximateCollisionsWithPoints bool If set to true should approximate collisions with points.
리턴 DistanceConstraint

setTearSensitivity() 공개 메소드

sets the tear sensitivity. if the ratio of the current distance / restingDistance is greater than tearSensitivity the Constaint will be removed
public setTearSensitivity ( float tearSensitivity ) : DistanceConstraint
tearSensitivity float Tear sensitivity.
리턴 DistanceConstraint

solve() 공개 메소드

public solve ( ) : void
리턴 void

프로퍼티 상세

restingDistance 공개적으로 프로퍼티

the resting distnace of the Constraint. It will always try to get to this distance.
public float restingDistance
리턴 float

shouldApproximateCollisionsWithPoints 공개적으로 프로퍼티

sets whether collisions should be approximated by points. This should be used for Constraints that need to collided on both sides. SAT only works with single sided collisions.
public bool shouldApproximateCollisionsWithPoints
리턴 bool

stiffness 공개적으로 프로퍼티

[0-1]. the stiffness of the Constraint. Lower values are more springy and higher are more rigid.
public float stiffness
리턴 float

tearSensitivity 공개적으로 프로퍼티

if the ratio of the current distance / restingDistance is greater than tearSensitivity the Constaint will be removed. Values should be above 1 and higher values mean rupture wont occur until the Constaint is stretched further.
public float tearSensitivity
리턴 float

totalPointsToApproximateCollisionsWith 공개적으로 프로퍼티

if shouldApproximateCollisionsWithPoints is true, this controls how accurate the collisions check will be. Higher numbers mean more collisions checks.
public int totalPointsToApproximateCollisionsWith
리턴 int