Definition
AddForceToCharacterController(float forceX, float forceY, float forceZ, float forceSpeed, float forceDecreaseValue)
Description
This function applies physics force to the main character of the game.
Parameters
forceX, forceY, forceZ
These three values determine the direction of the force that is assigned to the main character of the game. Vanda Engine normalizes the vector (forceX, forceY, forceZ).
forceSpeed
Determines the strength of the force.
forceDecreaseValue
Determines how fast the force decreases. The Venda engine multiplies this value by elapsedTime. For example, if we consider forceDecreaseValue as 1, the force will decrease by 1 unit per second.
Example
function OnTriggerEnter(otherActorName) AddForceToCharacterController(1.0, 10.0, 1.0, 20.0, 5.0) end function OnTriggerStay(otherActorName) end function OnTriggerExit(otherActorName) end
Let’s assume that this script is attached to a trigger called trigger1. When the main character or any object with dynamic physics enters this trigger, a force of 20.0 units is applied to the character in the normalized direction (1.0, 10.0, 1.0) and its power decreases by 5 units per second.
AddForceToCharacterController