Single Variable Force Script

Determines a dynamic object’s force in one variable. Good for force-based damage.

Needs one float property set at zero: iv

import GameLogic as g

import math

from math import sqrt

c = g.getCurrentController()

o = c.getOwner()

mass = o.getMass()

iv = o.iv

(vx,vy,vz) = o.getVelocity()

fv = sqrt(vx**2 + vy**2 + vz**2)

o.iv = fv

a = abs(fv-iv)*60

f = a * mass