SketchyPhysicsWiki
Advertisement

Script-level function included in LazyScript Plugin

setAccellVar[]

Creating an accelleration variable is easy using this function, which works similarly to SP's native get/set var system.

setAccellVar(key, control, accell, decell)

e.g:

setAccellVar("My Var","joy('lefty')",0.01,0.001)

key identifies the variable. You need this to retrieve it, and you can't use the same key more than once. This can be a string or number.

control is the controller. You need to write the controller code as a string (in quotes). If you need to write quotes inside this field, use ' instead of ", or vice versa, and you must use the correct syntax for the controller (e.g "joy('lefty')" rather than "lefty")

accell is how fast the variable will increase with the controller. This must be a number.

decell is how fast the variable will decrease with the controller. This must be a number.


Using this command with a key that already exists allows you to change that variable's settings, e.g. increase/decrease the speed of acceleration.

getAccellVar[]

Very simple command to use, retrieves the variable's value using the key you provide.

getAccellVar(key)

e.g:

getAccellVar("My Var")


Returns a value between 0 and 1, which will change as you accelerate / decelerate during the sim.

Advertisement