Are you telling the props to freeze? prop:GetPhysicsObject():EnableMotion(false)
function SpawnProps()
SpawnProp(Vector( 397.210815, 4368.070801, 74.644623 ), "models/sickness/busstop_01.mdl")
SpawnProp(Vector( -3963.573975, -6799.789551, 208.188354 ), "models/sickness/busstop_01.mdl")
end
hook.Add("InitPostEntity","SpawnTheProps",timer.Simple(1,SpawnProps))
function SpawnProp(position, model)
local ent1 = ents.Create("prop_physics")
local ang = Vector(0,0,1):Angle();
ang.pitch = ang.pitch + 90;
print("Prop spawned with model: " .. model)
ang:RotateAroundAxis(ang:Up(), math.random(0,360))
ent1:SetAngles(ang)
ent1:SetModel(model)
local pos = position
pos.z = pos.z - ent1:OBBMaxs().z
ent1:SetPos( pos )
ent1:Spawn()
end
thats my script.
[lua]local function SpawnProps()
SpawnProp(Vector( 397.210815, 4368.070801, 74.644623 ), "models/sickness/busstop_01.mdl")
SpawnProp(Vector( -3963.573975, -6799.789551, 208.188354 ), "models/sickness/busstop_01.mdl")
end
hook.Add("InitPostEntity","SpawnTheProps",function() timer.Simple(1,SpawnProps) end) --You shouldn't need a timer here.
function SpawnProp(position, model)
local ent1 = ents.Create("prop_physics")
if ent1 then
print("Prop spawned with model: " .. model)
ent1:SetAngles(Angle(0,math.random(0,360),0))
ent1:SetModel(model)
ent1:SetPos( pos - Vector(0,0,ent1:OBBMaxs().z) )
ent1:Spawn()
local phys = ent1:GetPhysicsObject()
if phys then phys:EnableMotion(false) end
end
end
[/lua]
Thanks!
Sorry, you need to Log In to post a reply to this thread.