Lua API

Overview

BeamNG.tech has some features that are not neccessarily part of the game. While the description of the Lua modules can be found elsewhere, this page focuses on documenting the C++ Lua api by showing function usage on the Lua side.

Module Engine

These are functions that are added to the existing Engine module for the BeamNG.tech version.

Member functions


Engine.getColorBufferBase64(width, height)

Getting color buffer from last render.

Args:

width(int): image width

height(int): image height

Returns: table

pixelsBase64(string): image, Base64 encoded

width(int): image width

height(int): image height


Engine.getDepthBufferBase64(width, height)

Gets depth buffer of last render.

Args:

width(int): image width

height(int): image height

Returns: table

pixelsBase64(string): image, Base64 encoded

width(int): image width

height(int): image height


Engine.openShmem(shmemName, size)

Opens shared memory handle with the given amount of bytes.

Args:

shmemName(string): name/id of the shared memory

size(int): size of the data to be shared

Returns: nil


Engine.closeShmem(shmemName)

Close previously opened shared memory handle.

Args:

shmemName(string): name/id of the shared memory handle

Returns: nil


Engine.getUltrasonicDistanceMeasurement(pos, rot, s, fov, nearFarPlanes)

Simulation of ultrasonic sensor, based on the depth image, thus the parameters that are similar to function calls rendering images. Warning: Although the function arguments won’t change, the implementation is subject to future change!

Args:

pos(Point3F): sensor position in the map

rot(QuatF): sensor orientation (quaternion)

s(Point2F): size

fov(float): horizontal field of view

nearFarPlanes(Point2F): defining the closest and furthest point to be rendered

Returns: float (distance measurement)

Page created: 23 March 2021, at 16:48
Last modified: 23 September 2021, at 16:08

Any further questions?

Join our discord