Lens Scripting API

    Enumeration ForceMode

    Type of force to use when applying force or torque to a BodyComponent.

    // @input Physics.BodyComponent bodyComponent

    // Add instant impulse force upward
    script.bodyComponent.addForce(new vec3(0, 500, 0), Physics.ForceMode.Impulse);

    // Add instant impulse torque to rotate the object
    script.bodyComponent.addTorque(new vec3(0, 0, Math.PI * -25), Physics.ForceMode.Impulse);

    // Every frame, add upward force over time, relative to the object rotation
    // This is similar to a rocket boosting the object upward
    script.createEvent("UpdateEvent").bind(function() {
    script.bodyComponent.addRelativeForce(new vec3(0, 2000, 0), Physics.ForceMode.Force);
    });
    Index

    Enumeration Members

    Acceleration: number

    Continuous acceleration (cm/s^2), applied without respect to mass, used for cases where force is applied over multiple frames.

    Force: number

    Continuous force (kg*cm/s^2), used for cases where force is applied over multiple frames.

    Impulse: number

    Instantaneous force impulse (kg*cm/s).

    VelocityChange: number

    Instantaneous change in velocity (cm/s), applied without respect to mass.

    MMNEPVFCICPMFPCPTTAAATR