• How to make your local player visible when using CalcView
    18 replies, posted
I have a thirdperson view made with the CalcView hook, and I knew I would come across this but I have no idea how to fix it. How can I get my player model to draw? If you tell me to use [code] function GM:ShouldDrawLocalPlayer() return true end [/code] it doesn't work.
I think ShouldDrawLocalPlayer does its own stuff, just hook a function to it that returns true instead.
You mean using hook.Add? Give me an example.
[QUOTE=LauScript;29875810]You mean using hook.Add? Give me an example.[/QUOTE] I guess he is talking about something like the example on this page [b][url=wiki.garrysmod.com/?title=Gamemode.CalcView]Gamemode.CalcView [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
I've tried using that hook.Add method it doesn't work.
[QUOTE=LauScript;29875972]I've tried using that hook.Add method it doesn't work.[/QUOTE] Worked for me last time I tried I will take a look when I am on my main pc tomorrow
You need to offset the render position because you're currently looking from inside the model to outside it - which means it's invisible to you.
That's exactly what I thought, but can I have an example? I'm very weak when it comes to vectors, offsets and all that.
local pos = pos - pl:GetAimVector() *0.1 Something along those lines.
still getting the invisible issue
Did you try to copy the example from [url]http://wiki.garrysmod.com/?title=Gamemode.CalcView[/url] ? If that doesn't work, it may be a mod messing with ShouldDrawLocalPlayer
Yeah I tried that. Even to exact code, still doesn't make my player visible.
[QUOTE=LauScript;29916909]Yeah I tried that. Even to exact code, still doesn't make my player visible.[/QUOTE] Then its something else conflicting with it since that example works perfectly
I think I'm on the right route, i'll release the code if it works [editline]18th May 2011[/editline] [QUOTE=King Flawless;29917080]Then its something else conflicting with it since that example works perfectly[/QUOTE] no it doesn't i don't run addons
I had something similar to this with my asteroids game mode, try setting the viewentity of the player to something other than the player, like an invisible prop just to test. I couldn't see my ship when it was my view entity. Hope this helps.
What do you mean
[b][url=http://wiki.garrysmod.com/?title=Player.SetViewEntity]Player.SetViewEntity [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
I'll experiment with it Okay, so that works , [editline]19th May 2011[/editline] Just incase anyone else was curious, [code] local ent = ents.Create("prop_physics") ent:SetModel("models/props_borealis/bluebarrel001.mdl") ent:SetNWString("owner", pl ) ent:SetPos( pl:GetPos() - (pl:EyeAngles():Forward()*200) + Vector( 0, 0, 100 )) ent:SetParent( pl ) ent:SetAngles( pl:EyeAngles() ) ent:SetColor( Color(0,0,0,0)) ent:Spawn() pl.VProp = ent pl:SetViewEntity(ent) [/code] talk about ghetto
talk about shit ass tabbing
Sorry, you need to Log In to post a reply to this thread.