Skip to content
Force Volume

Force Volume

TIP

It takes about 10 minutes to read this article.

This article outlines the definition and instructions for the Force Volume object in the editor.

What is the Force Volume Object

The Force Volume object itself is in a volume that exerts a parallel or radial force on an object with physical analog properties entering the volume, causing it to physically simulate movement.

Force Volume Object Properties

Locale

PropertiesDescription
automatically enabledSets whether zone physical effects are enabled. When disabled, no force is applied to the object.
Type of force appliedSets the force type.
Force valueSets the amount of physical force in the area.

Type of force applied

PropertiesDescription
Vector ForceApply an impulse in a certain direction
Radial ForceApply an impulse outward at the center of the circle

How to use Force Volume objects

1. Search the local asset library for [Force Volume], find the feature object, drag it into the scene and create it. 2. Set the effect of the force in the area in the property panel, the force value can be referenced to the current world gravity acceleration * object's own mass.

Force Volume Object Advanced Instructions

Force Volume Object Callback

ts
@Component
export default class NewScript1 extends Script {

    /** This function is called before the first frame update when the script is instanced */
    protected onStart(): void {

        let forceVolumeMain = this.gameObject as ForceVolume;

        // Force Volume object provides callback method
        forceVolumeMain.onEnter.add((chara: Character) => {
            console.log (`Character Entry Force Volume Range');
        })
        forceVolumeMain.onLeave.add((chara: Character) => {
            console.log (`Character Departure Force Volume Range');
        })
    }
}
@Component
export default class NewScript1 extends Script {

    /** This function is called before the first frame update when the script is instanced */
    protected onStart(): void {

        let forceVolumeMain = this.gameObject as ForceVolume;

        // Force Volume object provides callback method
        forceVolumeMain.onEnter.add((chara: Character) => {
            console.log (`Character Entry Force Volume Range');
        })
        forceVolumeMain.onLeave.add((chara: Character) => {
            console.log (`Character Departure Force Volume Range');
        })
    }
}