• render beam not rendering properly?
    9 replies, posted
for whatever reason, i can't get this to render a beam properly. it should render a beam in front of the local player's eyes instead it doesn't do anything at all even though it doesn't crash or return any errors. any help would be greatly appreciated: oh wow, can't even use a codebox. pastebin: [url]http://pastebin.com/mPEW3dsS[/url]
HUDPaint isn't a proper rendering block. You either need to start a 3d camera or move to a different hook.
[b][url=wiki.garrysmod.com/?title=Gamemode.PreDrawTranslucentRenderables]Gamemode.PreDrawTranslucentRenderables [img]http://wiki.garrysmod.com/favicon.ico[/img][/url] [url=wiki.garrysmod.com/?title=Gamemode.PreDrawOpaqueRenderables]Gamemode.PreDrawOpaqueRenderables [img]http://wiki.garrysmod.com/favicon.ico[/img][/url] [url=wiki.garrysmod.com/?title=Gamemode.PreDrawSkybox]Gamemode.PreDrawSkybox [img]http://wiki.garrysmod.com/favicon.ico[/img][/url] [url=wiki.garrysmod.com/?title=Gamemode.PrePlayerDraw]Gamemode.PrePlayerDraw [img]http://wiki.garrysmod.com/favicon.ico[/img][/url] [url=http://wiki.garrysmod.com/index.php?title=Gamemode.PreDrawViewModel]Gamemode.PreDrawViewModel [img]http://wiki.garrysmod.com/favicon.ico[/img][/url] [url=wiki.garrysmod.com/?title=Gamemode.PreDrawEffects]Gamemode.PreDrawEffects [img]http://wiki.garrysmod.com/favicon.ico[/img][/url] [url=wiki.garrysmod.com/?title=Gamemode.PostDrawTranslucentRenderables]Gamemode.PostDrawTranslucentRenderables [img]http://wiki.garrysmod.com/favicon.ico[/img][/url] [url=wiki.garrysmod.com/?title=Gamemode.PostDrawOpaqueRenderables]Gamemode.PostDrawOpaqueRenderables [img]http://wiki.garrysmod.com/favicon.ico[/img][/url] [url=wiki.garrysmod.com/?title=Gamemode.PostDrawSkybox]Gamemode.PostDrawSkybox [img]http://wiki.garrysmod.com/favicon.ico[/img][/url] [url=wiki.garrysmod.com/?title=Gamemode.PostPlayerDraw]Gamemode.PostPlayerDraw [img]http://wiki.garrysmod.com/favicon.ico[/img][/url] [url=wiki.garrysmod.com/?title=Gamemode.PostDrawViewModel]Gamemode.PostDrawViewModel [img]http://wiki.garrysmod.com/favicon.ico[/img][/url] [url=wiki.garrysmod.com/?title=Gamemode.PostDrawEffects]Gamemode.PostDrawEffects[img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Along with what Kogitsune said, use one of the render hooks that Wizard posted and also try to avoid creating the beam directly from the EyePos, from a direct angle you wont see much of the beam because it's a 2D material getting laid out in 3D space, so it might just appear as a thin line from your perspective.
Use LocalPlayer():GetViewModel():GetAttachment(LocalPlayer():GetViewModel():LookupAttachment("1")) instead of EyePos. Draw in cam.Start3D2D.
[QUOTE=Nick Clegg;29670205]Draw in cam.Start3D2D.[/QUOTE] What the hell are you talking about? Also you better cache the id.
my actual goal isn't to draw a viewmodel of the lasers, but just a view of what the player is looking at that points a laser (in future material) at it. i plan on changing it from local but yeah i tried out most of that stuff and it didn't work edit: nevermind, it actually does work but its behaving strangely [url]http://c0decub.com/pics/lasers.png[/url] [url]http://c0decub.com/pics/lasers2.png[/url] it's actually drawing from a point in the map i think and not from the player's perspective, i changed EyePos to EyeAngles and added the 3d cam but still no good
[QUOTE=Wizard of Ass;29670478]What the hell are you talking about? Also you better cache the id.[/QUOTE] Drawing a 2d beam in 3d space doesn't happen in a 2d drawing function.
nvm figured it out
[QUOTE=safforiveunch;29671937]my actual goal isn't to draw a viewmodel of the lasers, but just a view of what the player is looking at that points a laser (in future material) at it. i plan on changing it from local but yeah i tried out most of that stuff and it didn't work edit: nevermind, it actually does work but its behaving strangely [url]http://c0decub.com/pics/lasers.png[/url] [url]http://c0decub.com/pics/lasers2.png[/url] it's actually drawing from a point in the map i think and not from the player's perspective, i changed EyePos to EyeAngles and added the 3d cam but still no good[/QUOTE] Post the code. [QUOTE=Nick Clegg;29672479]Drawing a 2d beam in 3d space doesn't happen in a 2d drawing function.[/QUOTE] He is drawing a beam in a 3d realm, do you even know what cam.Start3D2D does?
Sorry, you need to Log In to post a reply to this thread.