API ReferenceGE Extensionsflowgraphnodestech
Create Ultrasonic Sensor (Flowgraph Node)
- **Node Name:** `Create Ultrasonic Sensor`
Overview
- Node Name:
Create Ultrasonic Sensor - Category:
once_instant - File:
extensions/flowgraph/nodes/tech/setupUltrasonicSensor.lua
Sets up an ultrasonic sensor on a vehicle and returns its ID.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
vehId | number | ID of the vehicle to attach the sensor to |
width | number | Width of the sensor (default: 50) |
height | number | Height of the sensor (default: 50) |
Output Pins
| Pin | Type | Description |
|---|---|---|
sensorId | number | ID of the created sensor |
Behavior
workOnce()- Creates an ultrasonic sensor on the specified vehicle (or player vehicle ifvehIdis nil). Passes width/height as asizearray. Returns the sensor ID.
How It Works
- Place this node and connect a vehicle ID (or leave blank for the player vehicle).
- Optionally set width and height dimensions.
- On first execution, creates the sensor and outputs its ID.
- Use the
sensorIdoutput withgetUltrasonicReadingsto poll data.
-- Internal call:
local vehId = self.pinIn.vehId.value or be:getPlayerVehicleID(0)
local args = {
size = { width or 50, height or 50 }
}
local sensorId = extensions.tech_sensors.createUltrasonic(vehId, args)Key Dependencies
extensions.tech_sensors.createUltrasonic()- Creates the sensorbe:getPlayerVehicleID(0)- Fallback vehicle ID
Additional Methods
C:init()
Initializes the node, setting up pins and default properties.
See Also
- Get Ultrasonic Readings (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide