メインコンテンツへスキップ

applyForce()

ecs.physics.applyForce(world, eid, forceX, forceY, forceZ)

Description

You can directly apply forces (linear and angular) to any entity with a physics collider. These forces are applied in the next physics simulation update, which takes place at regular intervals. The function accepts a 3D vector to define the force direction and magnitude.

Note: This is dependent on the frequency of calls to requestAnimationFrame() or your devices refresh rate.

Parameters

ParameterTypeDescription
worldnumberWorld
eidEidEntity id
forceXnumberforceX
forceYnumberforceY
forceZnumberforceZ

Returns

None.