Custom Markers
Call four exports and a label, arrow, outline or path appears in the world for the player wearing the headset. There is nothing to register up front — a marker exists from the moment you add it.Working example
examples/roadvr_examplemarkers is a complete, runnable resource. /track
annotates the nearest vehicle with all four kinds at once, and every line of
it is commented.What a marker is
An annotation on the world, not a window. It has no buttons, no page and no frame — a marker is a shape and, for some kinds, a line of your own text, placed at a point, on an entity, or along a line of points.The four kinds
outline needs nothing but entity. RoadVR reads the model’s dimensions once
and turns the box with the entity’s heading every frame — you never pass a size.
Your first marker
Two calls and a vehicle has an outline with a label beside it. This assumesveh is a vehicle handle you already hold:
client.lua
A marker on an entity cleans itself up. A marker on coordinates does
not — nothing but your resource will ever remove it. That difference is the
one thing worth keeping in mind while you write the tick that maintains them.
The four exports
Fields worth calling out
string
required
Cannot be patched. Everything else can — including
entity, which
re-targets an outline and measures the new model, and throughWalls, which
can be flipped after the marker already exists.vector3 / number
A marker has one place, not two. Patching
pos onto a marker that follows an
entity detaches it; patching entity onto a fixed one takes its pos away.
An outline lives on its entity and refuses a pos outright.string
Your text, localised by you. RoadVR adds no words of its own to a marker.
number
Metres. Leave it out — or ask for more than
Config.Markers.cullDistance
allows — and you get that ceiling instead. The marker stays fully opaque until
80% of its fade distance, then fades to nothing at it.removeRoadVrMarker and updateRoadVrMarker return false quietly on a
handle RoadVR does not know. That is deliberate: cleanup after a RoadVR
restart calls these on handles that are already gone, and that should not fill
the console with warnings.When RoadVR restarts
Markers are not persisted and do not survive a RoadVR restart —ensure roadvr
from the console, a crash, a script update.
This is the one pitfall everyone hits once: your resource kept running, the
vehicle is still there, but the outline and label are simply gone, because
RoadVR’s marker registry started over from empty.
client.lua
The limits
boolean
default:"true"
false switches the whole export surface off — addRoadVrMarker then returns
nil for everyone, not just for you.number
default:"32"
A per-resource ceiling. Go over it and the request is refused, rather than the
oldest marker quietly making room.
number
default:"120.0"
Metres. The server owner’s ceiling on
fadeDistance, and also where a marker
stops being drawn at all regardless of what any resource asked for.If nothing appears
1
Is a headset actually on?
A marker draws for the wearer only. Nobody wearing one is nobody seeing one.
2
Is Config.Markers.enabled still true?
Check the server’s
config.lua — it is a server-owner switch.3
Read the second return value
A bad definition returns
nil, reason, and the reason string says which:- a missing
entityon anoutline - no
texton alabel - fewer than two
pointson apath - an unknown
kind posandentitypassed together- an
entitythat does not exist — a0fromGetVehiclePedIsInon a ped who is on foot is the usual one - a
posthat is not avector3 - the resource already holding
Config.Markers.maxPerResourcemarkers
Related
Custom Apps
A window on the home screen
Custom Widgets
Your page on a wall
Custom Games
A multiplayer session with a lobby
Client API
Every Lua export in one place