Is this possible to do? if so, could anyone give me a quick sample on how; any help greatly appreciated!
You mean something like this?
local d=20 //Diameter
local r=d/2 //Radius
self.Entity:SetColor(255, 0, 0, 255)
Didn’t seem to work, it created a physicsinitsphere but the prop was missing and the material wasn’t added
Uh, you do realize the Physics model is invisible, right? You’ll need to set the world model of your entity to a sphere .mdl (I suggest the helibomb model), apply the material, color, and then scale it appropriately so it matches the radius of PhysicsInitSphere() you created for it.
This should be what theJ89 meant.
local s = 10; – this is the scale
self.Entity:SetModel("models/combine_helicopter/helicopter_bomb01.mdl") -- we're using the helibomb as it's almost a perfect sphere self.Entity:SetMaterial("Models/effects/splodearc_sheet") -- you should change this to the material local d = self.Entity:BoundingRadius() * 2 * s; -- diameter of the sphere self.Entity:SetColor(255, 0, 0, 255); -- this should be the color self.Entity:PhysicsInitSphere(d / 2); -- initialize the physics as a sphere self.Entity:SetCollisionBounds(Vector(-d / 2, -d / 2, -d / 2),Vector(d / 2, d / 2, d / 2)); -- set up the collision bounds
local s = 10; – this is the scale again - it should be same as on the server
ply:SetModelScale(Vector(s, s, s) -- It wasn't setting properly for me, unless called in the Think-function
Yes, it has whitespacing – click ‘view plain’ to see it properly. Note that the code is untested.