 # Prophunt Orientation, floating prop??

I’m working on modifying prophunt as a way to learn/get into lua. I have experience in programming. I got the syntax down, now I’m just trying to learn all the functions and such.

Ok so I found a way to lock the prop in a orientation based on pl:EyeAngles(), the problem I’m running into is the prop is floating on the x angle.

This is what I got

/entities/ph_prop/cl_init.lua

``````
-- The GetLocked and GetLockAngles are NetworkVars
function ENT:Draw()
local pl = self:GetOwner()
local Locked = self:GetLocked()
local Angles = Angle(0,0,0)

if Locked then
Angles = self:GetLockAngles()
else
Angles = pl:EyeAngles()
end

-- Angles
self:SetAngles(Angles)

-- Pos
self.Entity:SetPos(pl:GetPos() - Vector(0, 0, self.Entity:OBBMins().z))
self:SetPos(pl:GetPos() - Vector(0, 0, self.Entity:OBBMins().z))

self.Entity:DrawModel()
self:SetLockAngles(Angles)
end

``````

I’ve tried a few things but just can’t seem to get the prop to stay on the ground, all I’ve figured out is that the Z Pos is what needs to be changed. Anyone got any Ideas.

Anyone have an Idea?

You’re drawing the bottle in a different orientation. The reason the bottom floats is because the physics model is standing up, and you only drew it in a new position.

You can get the OBBMins, OBBCenter/Mid/Mids, OBBMaxs and calculate the distance to move the drawing based on the center to the mins/maxs based on rotation. It is just a bit more involved because you’re not actually moving the physics model.

I figured it out ``````
local posz = ((Mins.x -  Mins.z) * ((Angles.p - 0) / (89 - 0))) + Mins.z

-- Angles
self:SetAngles(Angles)

-- POS
self:SetPos(pl:GetPos() - Vector(0, 0, posz))

``````