Launch a prop at EyePos?

Hello all,

I’m trying to make a prop launch at the ‘EyePos’, but currently it just spawns and launches it with a very low speed, not reaching the actual ‘EyePos’. I looked all over the internet but couldn’t manage to find it. :frowning:
So, I want the prop monitor02.mdl to be launched at a high speed at the place the player is looking at, in a direct line. (Kills the player.)

Code so far (shoot.lua):

[LUA]
SWEP.PrintName = “Some text.”
SWEP.Author = “MyName”
SWEP.Instructions = “Some text.”

SWEP.Spawnable = true
SWEP.AdminOnly = true

SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = “none”

SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = true
SWEP.Secondary.Ammo = “none”

SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false

SWEP.Slot = 1
SWEP.SlotPos = 2
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = true

SWEP.ViewModel = “models/weapons/v_pistol.mdl”
SWEP.WorldModel = “models/weapons/w_pistol.mdl”

function SWEP:PrimaryAttack()

self.Weapon:SetNextPrimaryFire( CurTime() + 2.5 )	
self:ThrowChair( "models/props_lab/monitor02.mdl" )

end

function SWEP:SecondaryAttack()

self:ThrowChair( "models/props_lab/monitor02.mdl" )

end

function SWEP:ThrowChair( model_file )

if ( CLIENT ) then return end

local ent = ents.Create( "prop_physics" )

if (  !IsValid( ent ) ) then return end

ent:SetModel( model_file )

ent:SetPos( self.Owner:EyePos() + ( self.Owner:GetAimVector() * 16 ) )
ent:SetAngles( self.Owner:EyeAngles() )
ent:Spawn()

local phys = ent:GetPhysicsObject()
if (  !IsValid( phys ) ) then ent:Remove() return end

local velocity = self.Owner:GetAimVector()
velocity = velocity * 1000 
velocity = velocity + ( VectorRand() * 2 ) -- a random element
phys:ApplyForceCenter( velocity )

cleanup.Add( self.Owner, "props", ent )

undo.Create( "Thrown_Chair" )
	undo.AddEntity( ent )
	undo.SetPlayer( self.Owner )
undo.Finish()

end
[/LUA]

If you guys could help me, it would be awesome! :smiley:

[LUA] Tags around your code please.

[editline]5th June 2013[/editline]

Thank you.

Increase the force: multiply it by the props mass, so if you were to use a heavier prop it would still move the same

Add[lua]velocity = velocity * phys:GetMass()[/lua] between [lua]velocity = velocity + ( VectorRand() * 2 ) – a random element
–ADD IT HERE –
phys:ApplyForceCenter( velocity )[/lua]

^ works and alternatively you can use the massless functions AddVelocity and SetVelocityInstantaneous