Decals
A decal is an image the game projects onto a wall, the ground, a vehicle or an object: a poster, a tag, a company logo on a car. It is lit like the world. LS:MP draws a decal on one client only; with RLX, every player sees it, including those who join later, and it follows its vehicle when the vehicle streams back in.
lua
-- Server: a 2 x 1 m poster on the ground (the image is a file of YOUR resource)
local id = RLX.AddDecal({ image = "img/poster.png", position = { x = 215.0, y = -810.0, z = 29.7 }, width = 2, height = 1 })
-- On the left door of a vehicle (position and direction in the vehicle's space)
RLX.AddDecal({ image = "img/logo.png", entity = netId, position = { x = -0.95, y = 0, z = 0.3 },
direction = { x = 1, y = 0, z = 0 }, width = 1.2, height = 0.6, depth = 0.6 })
RLX.UpdateDecal(id, { opacity = 0.5, rotation = 90 }) -- only what is given changes
RLX.RemoveDecal(id)- Options:
position(required),direction(into the surface; default straight down),rotation,width,height(0.01 to 50 m),depth(0.05 to 20 m),color,opacity,longRange(seen up to about 500 m instead of 60 m),visible,dimension(one instance only),entity(a vehicle or an object, not a ped). imageis read on the server from your resource;datatakes the bytes of an image instead. Each client receives an image once, however many decals use it.- To find a point on a wall, use
lsmp.raycaston the client: the hit position, and the reverse of the normal asdirection. - A resource's decals go when it stops; a vehicle's decals go with the vehicle.
RLX.GetDecal(id),RLX.GetDecals(resource). - Events:
rlx:decalAdded(id, decal),rlx:decalRemoved(id). - Limits of LS:MP: 21 different images shown at the same time on a client, nearest first.