Want to set the position of ClientSideProp, client side
2 replies, posted
Hey there,
Im trying to create a client side prop from positions in a table received by the server. The idea is to have any given room be generated client side only.
Problem i am having is I cannot set a position on the client side prop or cEnt. It instead spawns it at what i would assume is 0,0,0. However returning the position in a different function shows the correct location.
Any ideas why its not showing in correct location in gmod?
net.Receive("SendClientRoom", function(len, ply)
c_roomData = net.ReadTable()
for k, v in pairs(c_roomData.grid) do
local cEnt = ents.CreateClientProp()
if cEnt:IsValid() then
cEnt:SetModel("models/hunter/plates/plate1x1.mdl")
--cEnt:SetParent(ply) -- instead places it near the feet at player
--cEnt:SetSolid(SOLID_VPHYSICS)
cEnt:SetParent(LocalPlayer())
cEnt:SetPos(Vector(v.gmX, v.gmY, v.gmZ))
cEnt:Spawn()
table.insert(c_roomEnts, cEnt)
else
print("CEnt is not valid")
end
end
for j,c in pairs(c_roomEnts) do
local entPos = c:GetPos()
print("x: ".. entPos.x .. " y: " .. entPos.y .. " z: ".. entPos.z )
end
end )
is this a dumb/ lost effort?
No past self. Dont give up. All you have to do is use ClientsideModel instead of CreateClientProp
Sorry, you need to Log In to post a reply to this thread.