Hey. So I've been trying to figure out a way to render text in a DModelPanel.
I tried to alter the 3D rendering space and adding a 3D2D within it, but i's causing me some issues and not quite playing to the way I want it. I'm able to have it display within my 3D rendering, however when i try to do things like rotate it, the rotation origin spot is somewhere far from where I predict it should be.
My aim is to be able to render text within a DModelPanel (above the model) and have it spin. Any help with this would be great as I've hit a wall
Code?
My guess is you have the 3D2D origin set somewhere where the player is and to compensate you just changed the coordinates of the text.
model.Paint = function( self, w, h )
if ( !IsValid( self.Entity ) ) then return end
local x, y = self:LocalToScreen( 0, 0 )
self:LayoutEntity( self.Entity )
local ang = self.aLookAngle
if ( !ang ) then
ang = ( self.vLookatPos - self.vCamPos ):Angle()
end
cam.Start3D( self.vCamPos, ang, self.fFOV, x, y, w, h, 5, self.FarZ )
render.SuppressEngineLighting( true )
render.SetLightingOrigin( self.Entity:GetPos() )
render.ResetModelLighting( self.colAmbientLight.r / 255, self.colAmbientLight.g / 255, self.colAmbientLight.b / 255 )
render.SetColorModulation( self.colColor.r / 255, self.colColor.g / 255, self.colColor.b / 255 )
render.SetBlend( ( self:GetAlpha() / 255 ) * ( self.colColor.a / 255 ) )
for i = 0, 6 do
local col = self.DirectionalLight[ i ]
if ( col ) then
render.SetModelLighting( i, col.r / 255, col.g / 255, col.b / 255 )
end
end
self:DrawModel()
render.SuppressEngineLighting( false )
cam.Start3D2D(Vector( 0, 210, 180), Angle(0, -90, 90), 0.25)
draw.SimpleText("I love my mum", "CloseCaption_Bold", 0, 0, Color(255,255,255))
cam.End3D2D()
cam.End3D()
self.LastPaint = RealTime()
end
Sorry, you need to Log In to post a reply to this thread.