@ue-too/dynamics / index / VisualPolygonBody
類別: VisualPolygonBody
定義於: rigidbody.ts:540
Rigid body interface for 2D physics simulation.
備註
Represents a physical object in the physics world with mass, velocity, rotation, and collision properties. Can be either static (immovable) or dynamic (responds to forces).
Implemented by Circle and Polygon classes.
實作
建構函式
建構函式
new VisualPolygonBody(
center,vertices,drawingContext,_orientationAngle,mass,isStatic,frictionEnabled):VisualPolygonBody
定義於: rigidbody.ts:553
參數
center
Point = ...
vertices
Point[]
drawingContext
CanvasRenderingContext2D
_orientationAngle
number = 0
mass
number = 50
isStatic
boolean = false
frictionEnabled
boolean = true
回傳
VisualPolygonBody
屬性
collisionFilter
collisionFilter:
CollisionFilter
定義於: rigidbody.ts:545
Collision filtering configuration
實作了
isSleeping
isSleeping:
boolean=false
定義於: rigidbody.ts:548
實作了
sleepThreshold
sleepThreshold:
number=0.01
定義於: rigidbody.ts:549
實作了
sleepTime
sleepTime:
number=0.5
定義於: rigidbody.ts:550
實作了
timeAtRest
timeAtRest:
number=0
定義於: rigidbody.ts:551
實作了
存取器
AABB
Getter 簽章
get AABB():
object
定義於: rigidbody.ts:660
Axis-Aligned Bounding Box for broad phase collision
回傳
object
max
max:
Point
min
min:
Point
Axis-Aligned Bounding Box for broad phase collision
實作了
angularVelocity
Getter 簽章
get angularVelocity():
number
定義於: rigidbody.ts:640
Angular velocity (radians/second)
回傳
number
Setter 簽章
set angularVelocity(
angularVelocity):void
定義於: rigidbody.ts:644
Angular velocity (radians/second)
參數
angularVelocity
number
回傳
void
Angular velocity (radians/second)
實作了
center
Getter 簽章
get center():
Point
定義於: rigidbody.ts:624
Center position in world coordinates
回傳
Point
Setter 簽章
set center(
dest):void
定義於: rigidbody.ts:628
Center position in world coordinates
參數
dest
Point
回傳
void
Center position in world coordinates
實作了
linearVelocity
Getter 簽章
get linearVelocity():
Point
定義於: rigidbody.ts:632
Linear velocity (pixels/second)
回傳
Point
Setter 簽章
set linearVelocity(
dest):void
定義於: rigidbody.ts:636
Linear velocity (pixels/second)
參數
dest
Point
回傳
void
Linear velocity (pixels/second)
實作了
mass
Getter 簽章
get mass():
number
定義於: rigidbody.ts:664
Mass in arbitrary units (affects force response)
回傳
number
Mass in arbitrary units (affects force response)
實作了
momentOfInertia
Getter 簽章
get momentOfInertia():
number
定義於: rigidbody.ts:676
Moment of inertia (rotational mass)
回傳
number
Moment of inertia (rotational mass)
實作了
orientationAngle
Getter 簽章
get orientationAngle():
number
定義於: rigidbody.ts:648
Rotation angle in radians
回傳
number
Rotation angle in radians
實作了
staticFrictionCoeff
Getter 簽章
get staticFrictionCoeff():
number
定義於: rigidbody.ts:668
Static friction coefficient (0-1)
回傳
number
Setter 簽章
set staticFrictionCoeff(
coeff):void
定義於: rigidbody.ts:672
Static friction coefficient (0-1)
參數
coeff
number
回傳
void
Static friction coefficient (0-1)
實作了
方法
applyForce()
applyForce(
force):void
定義於: rigidbody.ts:608
參數
force
Point
回傳
void
實作了
applyForceInOrientation()
applyForceInOrientation(
force):void
定義於: rigidbody.ts:612
參數
force
Point
回傳
void
實作了
RigidBody.applyForceInOrientation
draw()
draw(
ctx):void
定義於: rigidbody.ts:573
參數
ctx
CanvasRenderingContext2D
回傳
void
實作了
getAdjacentFaces()
getAdjacentFaces(
collisionNormal):object[]
定義於: rigidbody.ts:684
參數
collisionNormal
Point
回傳
object[]
實作了
getCollisionAxes()
getCollisionAxes(
relativeBody):Point[]
定義於: rigidbody.ts:604
參數
relativeBody
回傳
Point[]
實作了
getMinMaxProjection()
getMinMaxProjection(
unitvector):object
定義於: rigidbody.ts:600
參數
unitvector
Point
回傳
object
max
max:
number
min
min:
number
實作了
getNormalOfSignificantFace()
getNormalOfSignificantFace(
collisionNormal):Point
定義於: rigidbody.ts:680
參數
collisionNormal
Point
回傳
Point
實作了
RigidBody.getNormalOfSignificantFace
getSignificantVertices()
getSignificantVertices(
collisionNormal):Point[]
定義於: rigidbody.ts:656
參數
collisionNormal
Point
回傳
Point[]
實作了
RigidBody.getSignificantVertices
isMovingStatic()
isMovingStatic():
boolean
定義於: rigidbody.ts:596
回傳
boolean
實作了
isStatic()
isStatic():
boolean
定義於: rigidbody.ts:592
回傳
boolean
實作了
move()
move(
delta):void
定義於: rigidbody.ts:620
參數
delta
Point
回傳
void
實作了
setLinearVelocity()
setLinearVelocity(
linearVelocity):void
定義於: rigidbody.ts:616
參數
linearVelocity
Point
回傳
void
setSleeping()
setSleeping(
sleeping):void
定義於: rigidbody.ts:692
參數
sleeping
boolean
回傳
void
實作了
significantVertex()
significantVertex(
collisionNormal):Point
定義於: rigidbody.ts:652
參數
collisionNormal
Point
回傳
Point
實作了
step()
step(
deltaTime):void
定義於: rigidbody.ts:587
參數
deltaTime
number
回傳
void
實作了
updateSleeping()
updateSleeping(
deltaTime):void
定義於: rigidbody.ts:703
參數
deltaTime
number
回傳
void