Clientside Props With No Physics

Hi guys,
I have a strange problem here.

I have created a Clientside prop and have added some entity functions to it, but for some reason, it doesn’t have any physics.

(physProp is just another prop, it basically clones the prop and ghosts it)


local prop = ents.CreateClientProp()
prop:SetModel(physProp:GetModel())
prop:SetPos(physProp:GetPos())
prop:SetAngles(physProp:GetAngles())
prop:Spawn()
prop:SetSolid(SOLID_VPHYSICS) -- below
prop:SetMoveType(MOVETYPE_VPHYSICS) -- did I do anything wrong?
prop:SetNotSolid(true) -- This method doesn't seem to do anything. If I remove it, it still can be walked through.
prop:SetRenderMode(RENDERMODE_TRANSALPHA) -- below
prop:SetColor(255,255,255,150) -- It's not transparent, and it's pink.
prop:SetVelocity(Vector(1000,0,0)) -- nothing happens
timer.Simple(4,function() prop:Remove() end)

How can I add physics to this entity?
Thank you!

Have you tried not doing all that SetSolid/MoveType etc stuff?

I don’t think you can.

You never actually initialize the physics object. Try replacing prop:SetSolid(SOLID_VPHYSICS) with prop:PhysicsInit(SOLID_VPHYSICS).

You can’t make a PhysObj on the client.

gibs

Its okay here…


local prop = ents.CreateClientProp()
prop:Spawn()
prop:SetAngles(physProp:GetAngles())
prop:SetPos(physProp:GetPos())
prop:SetRenderMode(RENDERMODE_TRANSALPHA) 
prop:SetColor(255,255,255,150)
timer.Simple(4,function() prop:Remove() end)


but…


prop:SetModel(physProp:GetModel())  ----- It uses model same as physprop, ya know, I dont see any problem here 

prop:SetSolid(SOLID_VPHYSICS)  ----- You can try "SOLID_BBOX" or "prop:PhysicsInit()" function it should both work

prop:SetMoveType(MOVETYPE_VPHYSICS) -- did I do anything wrong? ----- I don't think so.

////prop:SetNotSolid(true) -- This is bullsh!t... delete it


prop:SetVelocity(Vector(1000,0,0)) ----- you don't need velocity right now


And you can try this…


local phys = prop:GetPhysicsObject() 
        phys:Wake()

Inform us how then, because whenever I try to run ent:PhyscsInit() on the client, I get the error C_PhysPropClientside::Initialize: PhysModelParseSolid failed for entity -1.

I’d like to see an example that produces this error.

I’d like to see an example that doesn’t.

[editline]6th March 2014[/editline]

Code that doesn’t work isn’t of much benefit to anyone here, show us how to actually do it so we can gain something from this.

Thank you!! This code seemed to work well!



local prop = ents.CreateClientProp()
prop:SetModel(physProp:GetModel())
prop:SetPos(physProp:GetPos())
prop:SetAngles(physProp:GetAngles())
prop:Spawn()
prop:PhysicsInit(SOLID_VPHYSICS)
prop:SetSolid(SOLID_VPHYSICS)
local phys = prop:GetPhysicsObject() 
phys:Wake()
prop:SetMoveType(MOVETYPE_VPHYSICS)
prop:SetRenderMode(RENDERMODE_TRANSALPHA)
prop:SetColor(255,255,255,150)


However, one problem.
For some reason, the prop is pink and is not transparent. Any help?

When I want something to render transparently I set it to RENDERMODE_NORMAL or 1…

The problem clearly is because he didn’t use the Color() function and inputted just the numbers into SetColor

correct type



prop:SetColor(Color(255,255,255,150))


Didn’t notice that; thanks. I wonder if effect files still use that format…

I was simply wondering what kind of code could possibly produce this error, because I’ve never seen it before.

If you want code that works, see above.

Thanks guys. All working now. :smiley: