TDM messing with my Cam3D2D license plates - Something I'm doing wrong?
11 replies, posted
[IMG]https://dl.dropbox.com/u/13645752/help.png[/IMG]
Any idea as to why the cars are chopping up my Cam3D2D?
[LUA]
include("shared.lua")
function ENT:Draw()
--self:DrawModel()
--if not IsValid(self:Getowning_ent()) or not IsValid(self:Getrecipient()) then return end
local Pos = self:GetPos()
local Ang = self:GetAngles()
local owner = self:GetOwner()
surface.SetFont("ChatFont")
cam.Start3D2D(Pos, Ang, 0.25)
surface.SetDrawColor(20,20,20,255)
surface.DrawRect(-50, -40, 100, 50)
draw.DrawText(self:GetNWString("License"), "ChatFont", -40, -25, Color(255,255,255,255), 0)
surface.SetDrawColor(20,250,20,255)
surface.DrawOutlinedRect(-50, -40, 100, 50)
cam.End3D2D()
end
[/LUA]
--Quite nice photography of the car to be honest with you..
[QUOTE=Minteh Fresh;40192169][IMG]https://dl.dropbox.com/u/13645752/help.png[/IMG]
Any idea as to why the cars are chopping up my Cam3D2D?[/QUOTE]
We can magically read your code from your screenshot shown...
Forgot to add it, sorry.
If the plate is transparent itll draw first or the other way around IIRC. Just switch between transparent and opaque to see if that fixes it. If not, draw the plate in the cars draw code
You're drawing the plate at the car's origin. You need to offset it.
[editline]7th April 2013[/editline]
Use
[url]http://wiki.garrysmod.com/page/Entity/GetForward[/url]
[url]http://wiki.garrysmod.com/page/Entity/GetRight[/url]
[url]http://wiki.garrysmod.com/page/Entity/GetUp[/url]
to get correctly angled vectors
rotatearoundaxis
None of this stuff worked, and it wasn't at the car's origin, no matter where the plate is, if the car is behind it the drawing of the plate messes up.
[IMG]https://dl.dropbox.com/u/13645752/Untitled.png[/IMG]
The plate is at eye level, and the NPC and the car are yonks away.
Is that a source vehicle? How are you adding these plates? Another entity?
[QUOTE=Robotboy655;40203780]Is that a source vehicle? How are you adding these plates? Another entity?[/QUOTE]
yes... its a source vehicle, even though he said (and the title of the thread says) TDM cars.
[QUOTE=G4MB!T;40203819]yes... its a source vehicle, even though he said (and the title of the thread says) TDM cars.[/QUOTE]
In that case you want to draw the license plates in PostDrawOpaqueRenderables or PostDrawTranslucentRenderables hooks.
I create a second entity (The plate) and parent it to the car, I draw the stuff by using ENT:Draw()
--EDIT--
PostDrawTranslucentRenderables fixed it, thanks a bunch Robot! <3
Sorry, you need to Log In to post a reply to this thread.