Physics3DManager Class
Physical systems manager.
Index
Properties
enabledbooleanWhether to enable the physics system, default is false.allowSleepbooleanWhether to allow the physics system to automatically hibernate, default is true.maxSubStepnumberThe maximum number of sub-steps a full step is permitted to be broken into, default is 2.deltaTimenumberTime spent in each simulation of physics, default is 1/60s.useFixedTimebooleanWhether to use a fixed time step.gravityVec3Gravity value of the physics simulation, default is (0, -10, 0).defaultMaterialPhysicsMaterial | nullGets the global default physical material.
Methods
updateA physical system simulation is performed once and will now be performed automatically once per frame.raycastDetect all collision boxes and return all detected results, or null if none is detected.raycastClosestDetect 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
deltaTimenumber 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
worldRayRay A ray in world spacegroupIndexOrNamenumber | string Collision group index or group namemaxDistancenumber Maximum detection distancequeryTriggerboolean 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 |