Physics3DManager Class

Module: cc Parent Module: cc

Physical systems manager.

Index

Properties
  • enabled boolean Whether to enable the physics system, default is false.
  • allowSleep boolean Whether to allow the physics system to automatically hibernate, default is true.
  • maxSubStep number The maximum number of sub-steps a full step is permitted to be broken into, default is 2.
  • deltaTime number Time spent in each simulation of physics, default is 1/60s.
  • useFixedTime boolean Whether to use a fixed time step.
  • gravity Vec3 Gravity value of the physics simulation, default is (0, -10, 0).
  • defaultMaterial PhysicsMaterial | null Gets the global default physical material.
Methods
  • update A physical system simulation is performed once and will now be performed automatically once per frame.
  • raycast Detect all collision boxes and return all detected results, or null if none is detected.
  • raycastClosest Detect all collision boxes and return the detection result with the shortest ray distance.

Details

Properties

enabled

Whether to enable the physics system, default is false.

meta description
Type boolean
Defined in cocos2d/core/3d/physics/framework/physics-manager.ts:46
allowSleep

Whether to allow the physics system to automatically hibernate, default is true.

meta description
Type boolean
Defined in cocos2d/core/3d/physics/framework/physics-manager.ts:60
maxSubStep

The maximum number of sub-steps a full step is permitted to be broken into, default is 2.

meta description
Type number
Defined in cocos2d/core/3d/physics/framework/physics-manager.ts:77
deltaTime

Time spent in each simulation of physics, default is 1/60s.

meta description
Type number
Defined in cocos2d/core/3d/physics/framework/physics-manager.ts:91
useFixedTime

Whether to use a fixed time step.

meta description
Type boolean
Defined in cocos2d/core/3d/physics/framework/physics-manager.ts:105
gravity

Gravity value of the physics simulation, default is (0, -10, 0).

meta description
Type Vec3
Defined in cocos2d/core/3d/physics/framework/physics-manager.ts:119
defaultMaterial

Gets the global default physical material. Note that builtin is null.

meta description
Type PhysicsMaterial | Null
Defined in cocos2d/core/3d/physics/framework/physics-manager.ts:136

Methods

update

A physical system simulation is performed once and will now be performed automatically once per frame.

meta description
Defined in cocos2d/core/3d/physics/framework/physics-manager.ts:210
Parameters
  • deltaTime number The time difference from the last execution is currently elapsed per frame
raycast

Detect all collision boxes and return all detected results, or null if none is detected. Note that the return value is taken from the object pool, so do not save the result reference or modify the result.

meta description
Returns PhysicsRayResult[] | Null
Defined in cocos2d/core/3d/physics/framework/physics-manager.ts:259
Parameters
  • worldRay Ray A ray in world space
  • groupIndexOrName number | string Collision group index or group name
  • maxDistance number Maximum detection distance
  • queryTrigger boolean Detect trigger or not
raycastClosest

Detect all collision boxes and return the detection result with the shortest ray distance. If not, return null value. Note that the return value is taken from the object pool, so do not save the result reference or modify the result.

meta description
Returns PhysicsRayResult | Null
Defined in cocos2d/core/3d/physics/framework/physics-manager.ts:286
Parameters
  • worldRay Ray A ray in world space
  • groupIndexOrName number | string Collision group index or group name
  • maxDistance number Maximum detection distance
  • queryTrigger boolean Detect trigger or not

results matching ""

    No results matching ""