API ReferenceGE ExtensionseditortechsensorConfiguration
Sensor Configuration - Conversions
Handles creation and lifecycle management of live sensors (Camera, LiDAR, Ultrasonic, RADAR, IMU, GPS, etc.) for the sensor configuration editor, including coordinate conversions between vehicle space
Handles creation and lifecycle management of live sensors (Camera, LiDAR, Ultrasonic, RADAR, IMU, GPS, etc.) for the sensor configuration editor, including coordinate conversions between vehicle space and sensor local frames.
Public API
| Function | Signature | Description |
|---|---|---|
M.makeSensorLive | (sensor, vehicle) | Creates a live sensor instance from configuration |
M.makeSensorNotLive | (sensor, vehicle) | Removes a live sensor instance |
M.createNewSensor | (sensorType, ctr, pos) → sensor | Creates a new sensor config from template |
M.getLiveSensorConfiguration | (sensorType, id, config) → config | Gets live sensor config with coord conversion |
M.updateLiveSensorPositionDirection | (sensor, vehicle) → bool | Updates live sensor position/direction |
Code Example
local conv = require('editor/tech/sensorConfiguration/conversions')
local stype = extensions.tech_sensors.stype
-- Create a new camera sensor at a position
local sensor = conv.createNewSensor(stype.tCamera, 1, vec3(0, 2, 1.5))
-- Make sensor live on a vehicle
local vehicle = { veh = be:getPlayerVehicle(0), vid = be:getPlayerVehicle(0):getID() }
conv.makeSensorLive(sensor, vehicle)
-- Update position/direction
conv.updateLiveSensorPositionDirection(sensor, vehicle)
-- Remove live sensor
conv.makeSensorNotLive(sensor, vehicle)
-- Supported sensor types and their templates:
-- stype.tCamera - Camera with size, fovY, renderColours, renderAnnotations, renderDepth
-- stype.tLiDAR - LiDAR with verticalResolution, frequency, maxDistance, is360
-- stype.tUltrasonic - Ultrasonic with rangeRoundness, rangeCutoffSensitivity, rangeShape
-- stype.tRADAR - RADAR with rangeBins, azimuthBins, velBins, halfAngleDeg
-- stype.tIMU - IMU with physicsUpdateTime, isUsingGravity, smootherStrength
-- stype.tGPS - GPS with refLon, refLat
-- Coordinate conversion flow for vehicle-mounted sensors:
-- 1. Convert pos from coefficients to vehicle-space using coeffs2PosVS
-- 2. Convert dir/up from sensor frame to vehicle-space using sensor2VS
-- 3. Set isStatic=false, isDirWorldSpace=trueDependencies
| Module | Purpose |
|---|---|
editor/tech/sensorConfiguration/utilities | Vehicle-space coordinate transforms |
tech_sensors | Sensor creation/removal API (stype enum) |
See Also
- Sensor Configuration - Utilities - Related reference
- World Editor Guide - Guide