hmm. i don't know how we could get the actual screen pixels of the entity since it is also depending of the distance etc.
The easiest would be to change the base of the entity. I think that would be possible in a 3d model editor.
Another way could be to set a pivot at the position and parent your entity to it.
Just like this:
function Script:Start()
self.pivot = Pivot:Create()
local entityscale = self.entity:GetScale()
local entityPos = self.entity:GetPosition()
entityPos.x = entityPos.x + (entityscale.x/2)
entityPos.z = entityPos.z + (entityscale.z/2)
self.pivot:SetPosition(entityPos)
self.entity:SetParent(self.pivot)
end
function Script:UpdateWorld()
local context=Context:GetCurrent()
local pos = self.camera:UnProject(Vec3(context:GetWidth(), 0, 1))
-- always face the camera
self.pivot:SetPosition(pos)
self.pivot:SetRotation(self.camera:GetRotation())
self.pivot:Turn(270, 0, 0)
end