Skip to content

@ue-too/dynamics / index / BaseRigidBody

抽象 類別: BaseRigidBody ​

定義於: rigidbody.ts:70

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.

Extended by ​

實作 ​

建構函式 ​

建構函式 ​

new BaseRigidBody(center, _orientationAngle, mass, isStaticBody, frictionEnabled): BaseRigidBody

定義於: rigidbody.ts:94

參數 ​

center ​

Point

_orientationAngle ​

number = 0

mass ​

number = 50

isStaticBody ​

boolean = false

frictionEnabled ​

boolean = false

回傳 ​

BaseRigidBody

屬性 ​

_angularVelocity ​

protected _angularVelocity: number

定義於: rigidbody.ts:74


_center ​

protected _center: Point

定義於: rigidbody.ts:71


_linearVelocity ​

protected _linearVelocity: Point

定義於: rigidbody.ts:73


_mass ​

protected _mass: number = 50

定義於: rigidbody.ts:72


_orientationAngle ​

protected _orientationAngle: number = 0

定義於: rigidbody.ts:75


_staticFrictionCoeff ​

protected _staticFrictionCoeff: number = 0.3

定義於: rigidbody.ts:79


angularDampingFactor ​

protected angularDampingFactor: number = 0.005

定義於: rigidbody.ts:83


collisionFilter ​

collisionFilter: CollisionFilter

定義於: rigidbody.ts:86

Collision filtering configuration

實作了 ​

RigidBody.collisionFilter


dynamicFrictionCoeff ​

protected dynamicFrictionCoeff: number = 0.3

定義於: rigidbody.ts:80


force ​

protected force: Point

定義於: rigidbody.ts:77


frictionEnabled ​

protected frictionEnabled: boolean = false

定義於: rigidbody.ts:81


isMovingStaticBody ​

protected isMovingStaticBody: boolean = false

定義於: rigidbody.ts:82


isSleeping ​

isSleeping: boolean = false

定義於: rigidbody.ts:89

實作了 ​

RigidBody.isSleeping


isStaticBody ​

protected isStaticBody: boolean = false

定義於: rigidbody.ts:78


linearAcceleartion ​

protected linearAcceleartion: Point

定義於: rigidbody.ts:76


sleepThreshold ​

sleepThreshold: number = 0.01

定義於: rigidbody.ts:90

實作了 ​

RigidBody.sleepThreshold


sleepTime ​

sleepTime: number = 0.5

定義於: rigidbody.ts:91

實作了 ​

RigidBody.sleepTime


timeAtRest ​

timeAtRest: number = 0

定義於: rigidbody.ts:92

實作了 ​

RigidBody.timeAtRest

存取器 ​

AABB ​

Getter 簽章 ​

get abstract AABB(): object

定義於: rigidbody.ts:324

Axis-Aligned Bounding Box for broad phase collision

回傳 ​

object

max ​

max: Point

min ​

min: Point

Axis-Aligned Bounding Box for broad phase collision

實作了 ​

RigidBody.AABB


angularVelocity ​

Getter 簽章 ​

get angularVelocity(): number

定義於: rigidbody.ts:130

Angular velocity (radians/second)

回傳 ​

number

Setter 簽章 ​

set angularVelocity(angularVelocity): void

定義於: rigidbody.ts:134

Angular velocity (radians/second)

參數 ​
angularVelocity ​

number

回傳 ​

void

Angular velocity (radians/second)

實作了 ​

RigidBody.angularVelocity


center ​

Getter 簽章 ​

get center(): Point

定義於: rigidbody.ts:290

Center position in world coordinates

回傳 ​

Point

Setter 簽章 ​

set center(dest): void

定義於: rigidbody.ts:294

Center position in world coordinates

參數 ​
dest ​

Point

回傳 ​

void

Center position in world coordinates

實作了 ​

RigidBody.center


linearVelocity ​

Getter 簽章 ​

get linearVelocity(): Point

定義於: rigidbody.ts:298

Linear velocity (pixels/second)

回傳 ​

Point

Setter 簽章 ​

set linearVelocity(dest): void

定義於: rigidbody.ts:302

Linear velocity (pixels/second)

參數 ​
dest ​

Point

回傳 ​

void

Linear velocity (pixels/second)

實作了 ​

RigidBody.linearVelocity


mass ​

Getter 簽章 ​

get mass(): number

定義於: rigidbody.ts:306

Mass in arbitrary units (affects force response)

回傳 ​

number

Mass in arbitrary units (affects force response)

實作了 ​

RigidBody.mass


momentOfInertia ​

Getter 簽章 ​

get abstract momentOfInertia(): number

定義於: rigidbody.ts:318

Moment of inertia (rotational mass)

回傳 ​

number

Moment of inertia (rotational mass)

實作了 ​

RigidBody.momentOfInertia


orientationAngle ​

Getter 簽章 ​

get orientationAngle(): number

定義於: rigidbody.ts:138

Rotation angle in radians

回傳 ​

number

Rotation angle in radians

實作了 ​

RigidBody.orientationAngle


staticFrictionCoeff ​

Getter 簽章 ​

get staticFrictionCoeff(): number

定義於: rigidbody.ts:310

Static friction coefficient (0-1)

回傳 ​

number

Setter 簽章 ​

set staticFrictionCoeff(coeff): void

定義於: rigidbody.ts:314

Static friction coefficient (0-1)

參數 ​
coeff ​

number

回傳 ​

void

Static friction coefficient (0-1)

實作了 ​

RigidBody.staticFrictionCoeff

方法 ​

applyForce() ​

applyForce(force): void

定義於: rigidbody.ts:162

參數 ​

force ​

Point

回傳 ​

void

實作了 ​

RigidBody.applyForce


applyForceInOrientation() ​

applyForceInOrientation(force): void

定義於: rigidbody.ts:170

參數 ​

force ​

number | Point

回傳 ​

void

實作了 ​

RigidBody.applyForceInOrientation


getAdjacentFaces() ​

abstract getAdjacentFaces(collisionNormal): object[]

定義於: rigidbody.ts:328

參數 ​

collisionNormal ​

Point

回傳 ​

object[]

實作了 ​

RigidBody.getAdjacentFaces


getCenter() ​

getCenter(): Point

定義於: rigidbody.ts:122

回傳 ​

Point


getCollisionAxes() ​

abstract getCollisionAxes(relativeBody): Point[]

定義於: rigidbody.ts:323

參數 ​

relativeBody ​

RigidBody

回傳 ​

Point[]

實作了 ​

RigidBody.getCollisionAxes


getMinMaxProjection() ​

abstract getMinMaxProjection(unitvector): object

定義於: rigidbody.ts:319

參數 ​

unitvector ​

Point

回傳 ​

object

max ​

max: number

min ​

min: number

實作了 ​

RigidBody.getMinMaxProjection


getNormalOfSignificantFace() ​

abstract getNormalOfSignificantFace(collisionNormal): Point

定義於: rigidbody.ts:327

參數 ​

collisionNormal ​

Point

回傳 ​

Point

實作了 ​

RigidBody.getNormalOfSignificantFace


getOrientationAngle() ​

getOrientationAngle(): number

定義於: rigidbody.ts:126

回傳 ​

number


getSignificantVertices() ​

abstract getSignificantVertices(collisionNormal): Point[]

定義於: rigidbody.ts:326

參數 ​

collisionNormal ​

Point

回傳 ​

Point[]

實作了 ​

RigidBody.getSignificantVertices


isMovingStatic() ​

isMovingStatic(): boolean

定義於: rigidbody.ts:146

回傳 ​

boolean

實作了 ​

RigidBody.isMovingStatic


isStatic() ​

isStatic(): boolean

定義於: rigidbody.ts:142

回傳 ​

boolean

實作了 ​

RigidBody.isStatic


move() ​

move(delta): void

定義於: rigidbody.ts:112

參數 ​

delta ​

Point

回傳 ​

void

實作了 ​

RigidBody.move


rotateRadians() ​

rotateRadians(angle): void

定義於: rigidbody.ts:118

參數 ​

angle ​

number

回傳 ​

void


setLinearVelocity() ​

setLinearVelocity(linearVelocity): void

定義於: rigidbody.ts:150

參數 ​

linearVelocity ​

Point

回傳 ​

void


setMovingStatic() ​

setMovingStatic(movingStatic): void

定義於: rigidbody.ts:154

參數 ​

movingStatic ​

boolean

回傳 ​

void


setOrientationAngle() ​

setOrientationAngle(angle): void

定義於: rigidbody.ts:158

參數 ​

angle ​

number

回傳 ​

void


setSleeping() ​

setSleeping(sleeping): void

定義於: rigidbody.ts:334

參數 ​

sleeping ​

boolean

回傳 ​

void

實作了 ​

RigidBody.setSleeping


significantVertex() ​

abstract significantVertex(collisionNormal): Point

定義於: rigidbody.ts:325

參數 ​

collisionNormal ​

Point

回傳 ​

Point

實作了 ​

RigidBody.significantVertex


step() ​

step(deltaTime): void

定義於: rigidbody.ts:186

參數 ​

deltaTime ​

number

回傳 ​

void

實作了 ​

RigidBody.step


updateSleeping() ​

updateSleeping(deltaTime): void

定義於: rigidbody.ts:345

參數 ​

deltaTime ​

number

回傳 ​

void

實作了 ​

RigidBody.updateSleeping