Physics3DManager Class
Physical systems manager.
Index
Properties
enabledbooleanGets or sets whether to enable physical systems, which are not enabled by default.allowSleepbooleanGets or sets whether the physical system allows automatic sleep, which defaults to true.maxSubStepnumberGets or sets the maximum number of child steps per frame simulated.deltaTimenumberGets or sets the fixed time consumed by each simulation step.useFixedTimebooleanGets or sets whether to use a fixed time step.gravityVec3Gets or sets the gravity value of the physical world, by default (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
Gets or sets whether to enable physical systems, which are not enabled by default.
| meta | description |
|---|---|
| Type | boolean |
| Defined in | cocos2d/core/3d/physics/framework/physics-manager.ts:46 |
allowSleep
Gets or sets whether the physical system allows automatic sleep, which defaults to true.
| meta | description |
|---|---|
| Type | boolean |
| Defined in | cocos2d/core/3d/physics/framework/physics-manager.ts:60 |
maxSubStep
Gets or sets the maximum number of child steps per frame simulated.
| meta | description |
|---|---|
| Type | number |
| Defined in | cocos2d/core/3d/physics/framework/physics-manager.ts:77 |
deltaTime
Gets or sets the fixed time consumed by each simulation step.
| meta | description |
|---|---|
| Type | number |
| Defined in | cocos2d/core/3d/physics/framework/physics-manager.ts:91 |
useFixedTime
Gets or sets whether to use a fixed time step.
| meta | description |
|---|---|
| Type | boolean |
| Defined in | cocos2d/core/3d/physics/framework/physics-manager.ts:105 |
gravity
Gets or sets the gravity value of the physical world, by default (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:196 |
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:223 |
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:250 |