31
Add-Ons / Event_EmitterTransform (and fixed onBrickLoaded)
« on: August 16, 2019, 09:51:07 PM »
Event_EmitterTransform
Version 1.0.4


Use events to adjust your emitter position, rotation, and scale!

setEmitterScale
Put in a single value (applied to x y and z) or 3 values (x y z). Scale defines a box that the emitter shoots out of (not rotated)
setEmitterTransform
-Vector to determine offset from the center of the brick
-Rotation (euler x y z in degrees, or axis-angle in radians. axis vector will be normalized)
Invalid rotation values (empty box or not exactly 3 or 4 values) will result in the emitter using the brick's wrench menu direction.
Simple explanation of how to use rotation
Euler rotation: Three values, in degrees, to rotate around the X, Y, and Z axis
The rotations are done in order (X axis first, then Y, then Z) - imagine rotating around x axis first, then the resulting position around the Y axis, then finally the Z axis
Axis-angle: 3 values to define a vector, plus a rotation value (radians) around said vector using right hand rule
Warning
Note: May find this working version of Event_onBrickLoaded to be useful for automatic emitter transformation on loading your build
Download
Version 1.0.4


Use events to adjust your emitter position, rotation, and scale!

setEmitterScale
Put in a single value (applied to x y and z) or 3 values (x y z). Scale defines a box that the emitter shoots out of (not rotated)
setEmitterTransform
-Vector to determine offset from the center of the brick
-Rotation (euler x y z in degrees, or axis-angle in radians. axis vector will be normalized)
Invalid rotation values (empty box or not exactly 3 or 4 values) will result in the emitter using the brick's wrench menu direction.
Simple explanation of how to use rotation
Euler rotation: Three values, in degrees, to rotate around the X, Y, and Z axis
The rotations are done in order (X axis first, then Y, then Z) - imagine rotating around x axis first, then the resulting position around the Y axis, then finally the Z axis
Axis-angle: 3 values to define a vector, plus a rotation value (radians) around said vector using right hand rule
Warning
Please be warned that setEmitterTransform screws up client saving, since it uses janky-ass client container searches to save emitters, items, and lights rather than have the server send the data over. So don't be surprised if your emitter gets assigned to the wrong brick.
Server autosavers should be fine since they use the actual emitter property of bricks.
Note: May find this working version of Event_onBrickLoaded to be useful for automatic emitter transformation on loading your build
Download


























