• Bonemerge Problem
    12 replies, posted
When I bonemerge something to my player's model, there becomes a duplicate of my player model, with the same texture of whatever is attached. I'm using this script in Sandbox, and have no addons. All the resources including .smd/.blend/.qc/.mdl :p [url]http://puu.sh/amWsC/9a9dce232b.zip[/url] [t]http://puu.sh/adZck/6c69ff9271.png[/t] [lua] local p = LocalPlayer() if p.Model then p.Model:Remove() p.Model = nil return end local m = ClientsideModel( "models/boots.mdl" ) m:SetParent( p ) m:SetMaterial( "models/props_junk/metalbucket01a" ) m:AddEffects( EF_BONEMERGE ) p.Model = m[/lua]
This is still a thing. :(
I'd assume this is when you die? In that caseu, you gotta unparent the thing, preferably remove it when player dies.
It's still there when I'm alive. You can see it very clearly when at a distance after the LOD changes. [t]http://puu.sh/ag5LG/5c20700abb.png[/t]
Try doing m:SetNoDraw(true) and m:DrawModel() somewhere in a 3D rendering hook. [editline]18th July 2014[/editline] [url]http://wiki.garrysmod.com/page/GM/PostPlayerDraw[/url]
[lua] local p = LocalPlayer() if p.Model then p.Model:Remove() p.Model = nil return end local m = ClientsideModel( "models/boots.mdl" ) m:SetNoDraw( true ) m:SetParent( p ) m:SetMaterial( "models/props_junk/metalbucket01a" ) m:AddEffects( EF_BONEMERGE ) p.Model = m hook.Add( "PostPlayerDraw", "DrawArmor", function( ply ) if IsValid( ply.Model ) then ply.Model:DrawModel() end end )[/lua] Makes the game crash immediately after running the script. No console errors. [url]http://puu.sh/ag7Kc/63688adf7b.mdmp[/url]
Not sure why, but it seems to be occuring because of the DrawModel function in the PostPlayerDraw hook, I just tried it myself. It did not crash when it wasn't called.
I don't recall ever having this problem with bonemerging. Did something break recently? :rolleyes: edit: So it gets much worse when I draw it in PostDrawOpaqueRenderables [t]http://puu.sh/agGN9/e06150f1b4.png[/t]
Can you try without the material?
When I don't set the material, it just shows a normal duplicate of the model. [t]http://puu.sh/ah8Ai/b80efb5d56.png[/t] And when I point the material's basetexture to the bucket texture, it still shows a duplicate model: [t]http://puu.sh/ah92p/89b1a3edc2.png[/t]
Is this a real bug or is something wrong? :S
Alright so the crash stops and everything appears to be in order when I do this: [lua] local p = LocalPlayer() if p.Model then p.Model:Remove() p.Model = nil return end local m = ClientsideModel( "models/boots.mdl" ) m:SetNoDraw( true ) m:SetParent( p ) m:AddEffects( EF_BONEMERGE ) p.Model = m local drawing = {} hook.Add( "PostPlayerDraw", "Boots", function( ply ) if drawing[ply] then return end if IsValid( ply.Model ) then drawing[ply] = true ply.Model:DrawModel() drawing[ply] = false end end )[/lua] Unfortunately, this also means that by calling :DrawModel() on that model, it in turn causes the player to draw again. Which means each frame the player is drawn twice. This is obvious when I set the material of the boots in this case, and it draws my player model with that material seamlessly. No longer does it draw though after death.
maybe if someone had vs2005 they could check the source code
Sorry, you need to Log In to post a reply to this thread.