My prop spawning system wont activate the physics.

So yeh this is extracted from my code but it spawns the prop but it is ghosted(you can walk through it) and doesn’t take hits or move. Excuse the probable overuse of Entity stuff but ive been trying everything lol.

[lua]
local spawnpos = LocalPlayer():GetEyeTrace().HitPos + LocalPlayer():GetEyeTrace().HitNormal * 32
propspawned = ents.Create(“prop_physics”)
propspawned:SetModel( v )
propspawned:SetSolid( SOLID_VPHYSICS )
propspawned:SetMoveType( MOVETYPE_VPHYSICS )
propspawned:PhysWake()
propspawned:PhysicsInit( SOLID_VPHYSICS )
propspawned:SetPos(spawnpos)
propspawned:Spawn()
propspawned:Activate()
[/lua]

[editline]07:27AM[/editline]

I’ve even tried

[lua]

local spawnpos = LocalPlayer():GetEyeTrace().HitPos + LocalPlayer():GetEyeTrace().HitNormal * 32
propspawned = ents.Create(“prop_physics”)
propspawned:SetModel( v )
propspawned:SetSolid( SOLID_VPHYSICS )
propspawned:SetMoveType( MOVETYPE_VPHYSICS )
propspawned:SetPos(spawnpos)
propspawned:SetAngles( Angle(0, 0, 0) )
propspawned:Spawn()
propspawned:Activate()
propspawned:PhysicsInit( SOLID_VPHYSICS )
propspawned:PhysWake()
end
[/lua]

Try removing this line:

[lua]propspawned:PhysicsInit( SOLID_VPHYSICS )[/lua]

Physics props already initialize their own physics automatically, so running this again might cause weird problems.

I’ve tried with and without it all.

[lua] propspawned = ents.Create(“prop_physics”)
propspawned:SetModel( v )
propspawned:SetPos(spawnpos)
propspawned:SetAngles( Angle(0, 0, 0) )
propspawned:Spawn()
propspawned:PhysWake()[/lua]

Try this, then. If this still doesn’t work, then there is really a problem somewhere.

Not working… code here…

[lua]
// The Q Menu Stuff :stuck_out_tongue:

function createmenu()

local props = {}

    props[1] = "models/props_lab/blastdoor001b.mdl"
    props[2] = "models/props_lab/blastdoor001a.mdl"
    props[3] = "models/props_junk/wood_crate002a.mdl"
    props[4] = "models/props_junk/wood_crate001a.mdl"
    props[5] = "models/props_wasteland/barricade001a.mdl"
    props[6] = "models/props_wasteland/wood_fence01a.mdl"
    props[7] = "models/props_c17/furnitureStove001a.mdl"
    props[8] = "models/props_c17/FurnitureSink001a.mdl"
    props[9] = "models/props_c17/fence03a.mdl"
    props[10] = "models/props_c17/fence01a.mdl"
    props[11] = "models/props_c17/FurnitureChair001a.mdl"
    props[12] = "models/props_junk/watermelon01.mdl"
    props[13] = "models/props_junk/TrafficCone001a.mdl"
    props[14] = "models/props_interiors/VendingMachineSoda01a.mdl"
    props[15] = "models/props_interiors/VendingMachineSoda01a_door.mdl"
    props[16] = "models/props_interiors/Furniture_shelf01a.mdl"
    props[17] = "models/props_vehicles/wagon001a_phy.mdl"
    props[18] = "models/props_phx/construct/metal_plate1.mdl"
    props[19] = "models/props_phx/construct/metal_plate1x2.mdl"
    props[20] = "models/props_phx/construct/metal_plate2x2.mdl"
    props[21] = "models/props_phx/construct/metal_plate4x4.mdl"
    props[22] = "models/props_phx/construct/metal_plate2x4.mdl"
    props[23] = "models/props_phx/construct/glass/glass_plate4x4.mdl"
    props[24] = "models/props_phx/construct/glass/glass_plate2x4.mdl"
    props[25] = "models/props_phx/construct/glass/glass_plate2x2.mdl"
    props[26] = "models/props_phx/construct/glass/glass_plate1x2.mdl"
    props[27] = "models/props_phx/construct/glass/glass_plate1x1.mdl"

mainframe = vgui.Create( “DFrame” )
mainframe:SetPos( ScrW()/17, ScrH()/17 *10 )
mainframe:SetSize( ScrW() - 150, 300 )
mainframe:SetTitle( “Props, Shops and Tools” )
mainframe:SetVisible( true )
mainframe:SetDraggable( false )
mainframe:ShowCloseButton( false )
mainframe:MakePopup()

toolarea = vgui.Create( “DPropertySheet” )
toolarea:SetParent( mainframe )
toolarea:SetPos( ScrW()/2.7, ScrH()/20)
toolarea:SetSize( ScrW()/2, ScrH()/2.8 )

IconList = vgui.Create( “DPanelList” )
IconList:EnableVerticalScrollbar( true )
IconList:EnableHorizontal( true )
IconList:SetPadding( 5 )
IconList:SetPos(10,30)
IconList:SetSize(200,350)

SheetItemTwo = vgui.Create( “DCheckBoxLabel” )
SheetItemTwo:SetText( “Use SENTs?” )
SheetItemTwo:SetConVar( “some_convar” )
SheetItemTwo:SetValue( 1 )
SheetItemTwo:SizeToContents()

toolarea:AddSheet( “Props”, IconList, “gui/silkicons/brick_add”, false, false, “Props Inside This Tab :D” )
toolarea:AddSheet( “Guns”, SheetItemTwo, “gui/silkicons/bomb”, false, false, “Guns Inside This Tab :D” )

    for k,v in pairs(props) do
    local icon = vgui.Create( "SpawnIcon", IconList )
    icon:SetModel( v )
    IconList:AddItem( icon )
    icon.DoClick = function( icon )
            surface.PlaySound( "ui/buttonclickrelease.wav" )
           
            local spawnpos = LocalPlayer():GetEyeTrace().HitPos + LocalPlayer():GetEyeTrace().HitNormal * 32

propspawned = ents.Create(“prop_physics”)
propspawned:SetModel( v )
propspawned:SetPos(spawnpos)
propspawned:SetAngles( Angle(0, 0, 0) )
propspawned:Spawn()
propspawned:PhysWake()
end
end
end

hook.Add( “OnSpawnMenuOpen”, “createmenu”, createmenu )

function closemenu()

mainframe:SetVisible( false )

end
hook.Add( “OnSpawnMenuClose”, “closemenu”, closemenu )
[/lua]

Oh derp, I was going to ask you if you were running that code serverside or not, but decided not to because I thought it was just stupid. Apparently I was wrong. :downs:

So yeah, if you’re spawning a prop clientside, it will stay clientside, and won’t exist on the server at all.
Just create a console command on the server (**[Concommand.Add

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Concommand.Add)), and run that console command from the client ([G.RunConsoleCommand

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=G.RunConsoleCommand)**).

Fixed it probs will do it when I get back home thanks