Skip to content

Instantly share code, notes, and snippets.

@tong
Last active December 3, 2022 14:26
Show Gist options
  • Save tong/9b70942824dfe282536fdadb7c07146e to your computer and use it in GitHub Desktop.
Save tong/9b70942824dfe282536fdadb7c07146e to your computer and use it in GitHub Desktop.
Armory fortunes
Translate object:
transform.translate(1, 2, 3);
%
Get world location:
transform.world.getLoc();
%
Access transform properties in world-space:
var m = transform.world; // Matrix
var l = transform.world.getLoc(); // Location
var r = new Quat().fromMat(transform.world); // Rotation
var s = transform.world.getScale(); // Scale
%
Access transform properties in object-space:
var m = transform.local; // Matrix
var l = transform.loc; // Location
var r = transform.rot; // Rotation
var s = transform.scale; // Scale
%
Manipulate the transform:
transform.translate(1, 2, 3); // x, y, z
transform.rotate(Vec4.zAxis(), 1.2); // Axis, angle in radians
%
Set location, rotation and scale using a matrix:
var m = Mat4.identity();
transform.setMatrix(m);
%
Retrieve world-space up, right and look vectors:
var up = transform.up(); // Z axis
var right = transform.right(); // X axis
var look = transform.look(); // Y axis
%
Find any object in the active scene by their name:
var myObj = iron.Scene.active.getChild("object name");
%
Find an existing Group (Collection in Blender) by its name:
var foes = iron.Scene.active.getGroup("foes");
%
When playing a sound, use the returned audio channel to query playback state:
var audioChannel: kha.audio1.AudioChannel = iron.system.Audio.play(sound);
trace(audioChannel.position); // In seconds
trace(audioChannel.finished);
%
Blender comes with a handy add-on which lets you jump straight into the source .blend of the selected linked object. Enable the Edit Linked Library add-on in the Blender preferences to unlock this functionality.
%
Auto Exposure or Eye Adaption is an effect where the the exposure in a scene is automatically adjusted based on the luminance in a frame. This effect mimics the ocular ability of the eye to adjust to various levels of darkness and light.
%
Bloom or Glow is a screen-effect that reproduces artifacts occurring in real world cameras, and helps giving the illusion of bright light seen through a camera. Due to the limitations of typical display sets not supporting HDR (High Dynamic Range), the possibility to render exceptionally bright objects is not available and thus clamped to an ordinary white color on SDR (Standard Dynamic Range). Despite this, game engines can still take HDR into account in terms of effects, where the HDR values are made available for shaders, with bloom being one of them.
%
Film Grain or Granularity is a screen effect typically seen in film and photography occurring due to small particles during the film processing. In Armory the effect is simulated by a shader adding noise each frame.
%
In photography a fisheye lens is an ultra-wide lens used to create a lens distortion that allows for a camera to capture views larger than 100 degrees. In Armory the default distortion is set to a mild level, in order to get the slight view distortion found in games such as GTA V and Battlefield.
%
Lens Flares is a photographic phenomenom where light is scattered inside the lens system of a camera. In Armory the lens flare effect is noticeable when a bright sun is placed in a scene.
%
Lens Textures in Armory is a texture overlayed on top of the screen to fit. This effect can, for instance, be used to simulate smudge and dust on a visor.
%
Letterboxing is an effect where a widescreen aspect ratio is transferred to a standard width video format. As the name refers to, the frame is compressed into a wider frame in the shape of a letterbox. In gaming it's often used during cutscenes and dialogues.
%
@tong
Copy link
Author

tong commented Dec 3, 2022

Usage

gh gist view 9b70942824dfe282536fdadb7c07146e | tail -n +3 > armory`
strfile armory
cp armory.dat /usr/share/fortune
fortune armory | cowsay -e "AA"
 ___________________________ 
/ Get world location:       \
|                           |
\ transform.world.getLoc(); /
 --------------------------- 
        \   ^__^
         \  (AA)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment