There are different kinds of physics bodies you can create in 3dverse: static body , rigid body , and
kinematic rigid body .
Note that these bodies are all rigid bodies in the classical sense, in that they stay solid and do not deform during collision.
The main difference between the static body and rigid body is that the former is static (expected not to move) during simulation whereas the latter is dynamic (expected to move).
Each of these physics bodies require you to attach some kind of geometry to them which will define their geometry in the physics engine.
Every physics body must have a
Schema contactVelocity Vector3
Default: [0,0,0]
dynamicFriction Float
Default: 0.5
The friction coefficient applied between this surface and another surface if they are moving relative to each other. Usually a value from 0 to 1. A value of zero feels like ice, a value of 1 will make it very hard to get the object moving. If set to greater than staticFriction, the effective value of staticFriction will be increased to match. Resulting dynamic friction of a physics body colliding with another is determined by the average of both bodies' dynamic friction coefficient.
isTrigger Boolean
Default: false
modifyContact Boolean
Default: false
restitution Float
Default: 0
Restitution coefficient, or bounciness of surface. A coefficient of 0 indicates as little bounce as possible, higher values up to 1.0 result in more bounce. Should be in the range [0,1]. Resulting bounciness of a physics body colliding with another is determined by the average of both bodies' restitution.
staticFriction Float
Default: 0.5
The friction coefficient applied between this surface and another surface if they are not moving lateral to each other. Usually a value from 0 to 1. A value of zero feels like ice, a value of 1 will make it very hard to get the object moving. Resulting static friction of a physics body colliding with another is determined by the average of both bodies' static friction coefficient.
and some sort of geometry component.
Static Body
When to use a static body? For an entity that will not move during simulation such as a wall, the ground, or a building.
A static body will not be affected by forces such as gravity.
To make your entity a static body it needs the following components:
Schema contactVelocity Vector3
Default: [0,0,0]
dynamicFriction Float
Default: 0.5
The friction coefficient applied between this surface and another surface if they are moving relative to each other. Usually a value from 0 to 1. A value of zero feels like ice, a value of 1 will make it very hard to get the object moving. If set to greater than staticFriction, the effective value of staticFriction will be increased to match. Resulting dynamic friction of a physics body colliding with another is determined by the average of both bodies' dynamic friction coefficient.
isTrigger Boolean
Default: false
modifyContact Boolean
Default: false
restitution Float
Default: 0
Restitution coefficient, or bounciness of surface. A coefficient of 0 indicates as little bounce as possible, higher values up to 1.0 result in more bounce. Should be in the range [0,1]. Resulting bounciness of a physics body colliding with another is determined by the average of both bodies' restitution.
staticFriction Float
Default: 0.5
The friction coefficient applied between this surface and another surface if they are not moving lateral to each other. Usually a value from 0 to 1. A value of zero feels like ice, a value of 1 will make it very hard to get the object moving. Resulting static friction of a physics body colliding with another is determined by the average of both bodies' static friction coefficient.
One geometry component from this list: Entity Component Box Geometry box_geometry Box geometry.
Schema dimension Vector3
Default: [1,1,1]
offset Vector3
Default: [0,0,0]
, Entity Component Capsule Geometry capsule_geometry Capsule geometry.
Schema axis Integer
Default: [1] Y-Axis
[0] X-Axis [1] Y-Axis [2] Z-Axis
offset Vector3
Default: [0,0,0]
, Entity Component Sphere Geometry sphere_geometry Sphere geometry.
Schema offset Vector3
Default: [0,0,0]
, Entity Component Cylinder Geometry cylinder_geometry Cylinder geometry.
Schema axis Integer
Default: [1] Y-Axis
[0] X-Axis [1] Y-Axis [2] Z-Axis
offset Vector3
Default: [0,0,0]
, Entity Component Plane Geometry plane_geometry Plane geometry.
Schema normal Vector3
Default: [0,1,0]
or Collision Geometry Reference Schema collisionGeometryRef Asset UUID
Rigid Body
When to use a rigid body? For an entity that that you want to be affected by forces such as gravity. Collision resolution of rigid bodies is made to seem very “physically accurate”.
A rigid body will collide against all other physics bodies.
To make your entity a rigid body it needs the following components:
Schema contactVelocity Vector3
Default: [0,0,0]
dynamicFriction Float
Default: 0.5
The friction coefficient applied between this surface and another surface if they are moving relative to each other. Usually a value from 0 to 1. A value of zero feels like ice, a value of 1 will make it very hard to get the object moving. If set to greater than staticFriction, the effective value of staticFriction will be increased to match. Resulting dynamic friction of a physics body colliding with another is determined by the average of both bodies' dynamic friction coefficient.
isTrigger Boolean
Default: false
modifyContact Boolean
Default: false
restitution Float
Default: 0
Restitution coefficient, or bounciness of surface. A coefficient of 0 indicates as little bounce as possible, higher values up to 1.0 result in more bounce. Should be in the range [0,1]. Resulting bounciness of a physics body colliding with another is determined by the average of both bodies' restitution.
staticFriction Float
Default: 0.5
The friction coefficient applied between this surface and another surface if they are not moving lateral to each other. Usually a value from 0 to 1. A value of zero feels like ice, a value of 1 will make it very hard to get the object moving. Resulting static friction of a physics body colliding with another is determined by the average of both bodies' static friction coefficient.
one geometry component from this list: Entity Component Box Geometry box_geometry Box geometry.
Schema dimension Vector3
Default: [1,1,1]
offset Vector3
Default: [0,0,0]
, Entity Component Capsule Geometry capsule_geometry Capsule geometry.
Schema axis Integer
Default: [1] Y-Axis
[0] X-Axis [1] Y-Axis [2] Z-Axis
offset Vector3
Default: [0,0,0]
, Entity Component Sphere Geometry sphere_geometry Sphere geometry.
Schema offset Vector3
Default: [0,0,0]
, Entity Component Cylinder Geometry cylinder_geometry Cylinder geometry.
Schema axis Integer
Default: [1] Y-Axis
[0] X-Axis [1] Y-Axis [2] Z-Axis
offset Vector3
Default: [0,0,0]
or Collision Geometry Reference Schema collisionGeometryRef Asset UUID
(but the collision geometry must be convex, NOT triangular)
Entity Component Rigid Body rigid_body Rigid body parameters.
Schema angularDamping Float
Default: 0.05
centerOfMass Vector3
Default: [0,0,0]
collisionDetection Unsigned Byte
Default: [0] Discrete
[0] Discrete [1] LinearContinuous [2] AngularContinuous [3] Continuous
isKinematic Boolean
Default: false
linearDamping Float
Default: 0
lockedAxis Unsigned Byte
Default: 0
[1] Linear X [2] Linear Y [4] Linear Z [8] Angular X [16] Angular Y [32] Angular Z
maxAngularVelocity Float
Default: 100
useGravity Boolean
Default: true
(with isKinematic = false)
Kinematic Rigid Body
When to use a kinematic rigid body? For an entity that you want to move manually during simulation (e.g. by affecting its transform), such as a rotating door. A kinematic rigid body will not be affected by any forces such as gravity.
If you move a kinematic rigid body it will collide against rigid bodies, but not against static or kinematic rigid bodies (i.e. if you move it into a static body or another kinematic rigid body, it will go through, but if you move it into a rigid body, this will move your rigid body).
To make your entity a kinematic rigid body it needs the following components:
Schema contactVelocity Vector3
Default: [0,0,0]
dynamicFriction Float
Default: 0.5
The friction coefficient applied between this surface and another surface if they are moving relative to each other. Usually a value from 0 to 1. A value of zero feels like ice, a value of 1 will make it very hard to get the object moving. If set to greater than staticFriction, the effective value of staticFriction will be increased to match. Resulting dynamic friction of a physics body colliding with another is determined by the average of both bodies' dynamic friction coefficient.
isTrigger Boolean
Default: false
modifyContact Boolean
Default: false
restitution Float
Default: 0
Restitution coefficient, or bounciness of surface. A coefficient of 0 indicates as little bounce as possible, higher values up to 1.0 result in more bounce. Should be in the range [0,1]. Resulting bounciness of a physics body colliding with another is determined by the average of both bodies' restitution.
staticFriction Float
Default: 0.5
The friction coefficient applied between this surface and another surface if they are not moving lateral to each other. Usually a value from 0 to 1. A value of zero feels like ice, a value of 1 will make it very hard to get the object moving. Resulting static friction of a physics body colliding with another is determined by the average of both bodies' static friction coefficient.
one geometry component from this list: Entity Component Box Geometry box_geometry Box geometry.
Schema dimension Vector3
Default: [1,1,1]
offset Vector3
Default: [0,0,0]
, Entity Component Capsule Geometry capsule_geometry Capsule geometry.
Schema axis Integer
Default: [1] Y-Axis
[0] X-Axis [1] Y-Axis [2] Z-Axis
offset Vector3
Default: [0,0,0]
, Entity Component Sphere Geometry sphere_geometry Sphere geometry.
Schema offset Vector3
Default: [0,0,0]
, Entity Component Cylinder Geometry cylinder_geometry Cylinder geometry.
Schema axis Integer
Default: [1] Y-Axis
[0] X-Axis [1] Y-Axis [2] Z-Axis
offset Vector3
Default: [0,0,0]
, Entity Component Plane Geometry plane_geometry Plane geometry.
Schema normal Vector3
Default: [0,1,0]
or Collision Geometry Reference Schema collisionGeometryRef Asset UUID
Entity Component Rigid Body rigid_body Rigid body parameters.
Schema angularDamping Float
Default: 0.05
centerOfMass Vector3
Default: [0,0,0]
collisionDetection Unsigned Byte
Default: [0] Discrete
[0] Discrete [1] LinearContinuous [2] AngularContinuous [3] Continuous
isKinematic Boolean
Default: false
linearDamping Float
Default: 0
lockedAxis Unsigned Byte
Default: 0
[1] Linear X [2] Linear Y [4] Linear Z [8] Angular X [16] Angular Y [32] Angular Z
maxAngularVelocity Float
Default: 100
useGravity Boolean
Default: true
(with isKinematic = true)
Character Controller
See Character Controller .
Trigger
A trigger physics body is a physics body with isTrigger set to true in its
Schema contactVelocity Vector3
Default: [0,0,0]
dynamicFriction Float
Default: 0.5
The friction coefficient applied between this surface and another surface if they are moving relative to each other. Usually a value from 0 to 1. A value of zero feels like ice, a value of 1 will make it very hard to get the object moving. If set to greater than staticFriction, the effective value of staticFriction will be increased to match. Resulting dynamic friction of a physics body colliding with another is determined by the average of both bodies' dynamic friction coefficient.
isTrigger Boolean
Default: false
modifyContact Boolean
Default: false
restitution Float
Default: 0
Restitution coefficient, or bounciness of surface. A coefficient of 0 indicates as little bounce as possible, higher values up to 1.0 result in more bounce. Should be in the range [0,1]. Resulting bounciness of a physics body colliding with another is determined by the average of both bodies' restitution.
staticFriction Float
Default: 0.5
The friction coefficient applied between this surface and another surface if they are not moving lateral to each other. Usually a value from 0 to 1. A value of zero feels like ice, a value of 1 will make it very hard to get the object moving. Resulting static friction of a physics body colliding with another is determined by the average of both bodies' static friction coefficient.
component.
When to use a trigger? Make your physics body a trigger if you want to be notified of and react to collisions (in a script or in your application code) that involve that trigger body.
Trigger bodies do not have any collision resolution though, they are simply collision “sensors”.
Trigger bodies are used for triggering events, and whatever collision that may occur with them is detected, but not resolved by the physics engine .
A trigger event allows a developer to react to two entities colliding and apply some logic to that. See Physics-Based Events for more info on trigger events.
Best Practices
The recommendations of “when to use” each physics body are best practices.
For example, a static body is recommended for a non-moving entity.
Although you probably shouldn’t, don’t be surprised if you can actually move a static body during simulation by changing its transform.
However, collision detection may not work as well and you may get unexpected results because of the way the physics engine is optimized.
So it’s important to configure your physics bodies correctly and follow the recommendations outlined in this doc.
Enable debug lines! To see what the physics engine sees, enable debug lines. This will allow you to verify if your physics bodies have been well set up. If you can see the debug lines of your geometry, that means your entity has been well registered inside the physics engine. See Debug Lines for further info.