3D Text

3 replies1,564 views4y ago
Original post · 4y ago#1
does somebody have some clean script for custom 3D texts?

3 replies

4y ago#2
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)
local player = PlayerPedId()
local coords = GetEntityCoords(player)
local coords_plus = vector3(coords.x, coords.y, coords.z+1.2)
local r = 58
local g = 115
local b = 208
local a = 215
local my_string = "My text over head"
DrawText3D(coords_plus,my_string,scale_x,scale_y,r,g,b,a)
end
end)

function DrawText3D(coords, text, scale_x, scale_y, r, g, b, a)
local onScreen,_x,_y = World3dToScreen2d(coords)
local game_coords = GetGameplayCamCoord()
local dist = #(game_coords - coords)

local scale = (1/dist)*2
local fov = (1/GetGameplayCamFov())*100
local scale = scale*fov

if onScreen then
SetTextScale(scale_x, scale_y)
SetTextFont(4)
SetTextProportional(1)
SetTextColour(r, g, b, a)
SetTextEntry("STRING")
SetTextCentre(1)
SetTextOutline()
AddTextComponentString(text)
DrawText(_x,_y)
end
end
0
4y ago#3
programok3, post: 38358, member: 8963
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)
local player = PlayerPedId()
local coords = GetEntityCoords(player)
local coords_plus = vector3(coords.x, coords.y, coords.z+1.2)
local r = 58
local g = 115
local b = 208
local a = 215
local my_string = "My text over head"
DrawText3D(coords_plus,my_string,scale_x,scale_y,r,g,b,a)
end
end)

function DrawText3D(coords, text, scale_x, scale_y, r, g, b, a)
local onScreen,_x,_y = World3dToScreen2d(coords)
local game_coords = GetGameplayCamCoord()
local dist = #(game_coords - coords)

local scale = (1/dist)*2
local fov = (1/GetGameplayCamFov())*100
local scale = scale*fov

if onScreen then
SetTextScale(scale_x, scale_y)
SetTextFont(4)
SetTextProportional(1)
SetTextColour(r, g, b, a)
SetTextEntry("STRING")
SetTextCentre(1)
SetTextOutline()
AddTextComponentString(text)
DrawText(_x,_y)
end
end

??
0
4y ago#4
Following
0

Sign in to reply

Join the discussion — it takes less than a minute.