Skip to main content

Contact Velocity

Contact velocity refers to the relative velocity between two colliding physics bodies at their contact point.

This is calculated by the physics engine by default, but it can be overridden using the modifyContact and contactVelocity attributes in the physics_material component. This can be used to simulate platforms which impart velocity to objects standing on them, such as conveyor belts.

Physics Material Component In Conveyor Belt Setting
Take notice of contactVelocity and modifyContact in the physics material component.

Physics Material

physics_material

Physics material which represents a set of physical surface properties.

contactVelocity

Vector3

Default: [0,0,0]

The velocity applied to the contact between this physics body and another body. Only applies if modifyContact is true.

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

Whether to consider the geometry associated to this physics material as a trigger or not.

modifyContact

Boolean

Default: false

Whether to modify the contact when this physics body collides with another body.

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.

To enable contactVelocity set modifyContact to true.

Then, contactVelocity will be used as the target relative velocity for the contact points between this physics body and all other bodies colliding with it, rather than letting natural physics determine the outcome.

In the case of a conveyor belt, contactVelocity allows objects on the conveyor belt surface to move as if the surface itself is moving at a constant speed, regardless of the objects' natural tendency to come to rest due to friction.

Setting up a conveyor belt

Make the conveyor belt a static body with modifyContact set to true and contactVelocity set to the desired velocity. All rigid bodies that come in contact with it will then have a target relative velocity equal to contactVelocity.