# Vectors based on Player instead of World

I’m attempting to create a series of Vector points in front of the player, and I’ve got it working but only from one angle because the Vector math is being based off of the world.

Picture illustration:

http://www.blushell.net/pics/working.png

This is the effect I want to happen. The oranges are only there for visual markers. However if you move to any other angle:

http://www.blushell.net/pics/notworking.png

the oranges remain on the same “plane” as they were the first time.

``````
local mult = 25 // Multiplier to set how far away the points are
local dpos = {}
dpos[1] = { X = 0, Y = 0, Z = mult }
dpos[2] = { X = 0, Y = mult, Z = 0 }
dpos[3] = { X = 0, Y = 0, Z = -mult }
dpos[4] = { X = 0, Y = -mult, Z = 0 }

dpos[5] = { X = 0, Y = -mult/2, Z = mult/2 }
dpos[6] = { X = 0, Y = mult/2, Z = mult/2 }
dpos[7] = { X = 0, Y = mult/2, Z = -mult/2 }
dpos[8] = { X = 0, Y = -mult/2, Z = -mult/2 }

dpos[9] = { X = 0, Y = -mult/4, Z = mult/4 }
dpos[10] = { X = 0, Y = mult/4, Z = mult/4 }
dpos[11] = { X = 0, Y = mult/4, Z = -mult/4 }
dpos[12] = { X = 0, Y = -mult/4, Z = -mult/4 }

function DebugPos( ply, c, a )
local ending = ply:GetShootPos() + ( ply:GetAimVector() * 100 )
for k, v in pairs( dpos ) do
local ent = ents.Create("fruit")
local vec = Vector( ending.x, ending.y + v.Y, ending.z + v.Z )
ent:SetPos( vec )
ent:SetModel("models/props/cs_italy/orange.mdl")
ent:Spawn()
local phys = ent:GetPhysicsObject()
phys:EnableMotion(false)
end
local ent = ents.Create("fruit") // This is the center orange
ent:SetPos( ending )
ent:SetModel("models/props/cs_italy/orange.mdl")
ent:Spawn()
local phys = ent:GetPhysicsObject()
phys:EnableMotion(false)
end