v5.2 build 127 (June 26, 2023)

Post Reply
User avatar
Support
Site Admin
Posts: 3080
Joined: Sun Oct 02, 2011 10:49 am

v5.2 build 127 (June 26, 2023)

Post by Support »

Fixed some script compile errors.

Changes "Units := Metars;" to...

SetUnits(unit)';

Added a new variable "FirstPass" that you can use instead of "cf = 1" to test if the script is ran for the first time.

Also added a new function...

FreeFall(Velocity, Gravity, Restitution, BottomPos);

Where "Velocity" is a variable that keeps track of the object's velocity. You basically set it to zero in the "FistPass" section...

if FirstPass then
Velocity := 0.0;

"Gravity" is a gravity constant, usually, 9.8

"Restitution" is how much of a bounce back for the object, 0.7 to 0.9 are good values. The lower the less bounce.

"BottomPos" is the position at which the object stops falling and bounce back, set it to zero for ground level.

Here is the script for the falling ball example...

Code: Select all

SetUnits(Meters);

if FirstPass then
  Velocity := 0.0;

FreeFall(Velocity, 9.8, 0.7, 0.1090145);

// The ball's center is at 0, so we need to add its radius of 0.1090145 to the ground level.

px := 0.04; // make the ball move in the X axis
Your support team.
https://SoftByteLabs.com
Post Reply