Position problem

Ghostentity should move from Entity position + where it’s looking at, but somehow it messes up and goes inside trace.Entity if its rotation is NOT (0,0,0). What to do?

Thanks.



HitNormal = trace.HitNormal

local mins = GhostEntity:OBBMins()
local maxs = GhostEntity:OBBMaxs()
	
local xSize = maxs.X - mins.X
local ySize = maxs.Y - mins.Y
local zSize = maxs.Z - mins.Z

GridLocation = trace.Entity:GetPos()
+ (trace.Entity:GetForward() * xSize * HitNormal.X)
+ (trace.Entity:GetRight() * ySize * HitNormal.Y)
+ (trace.Entity:GetUp() * zSize * HitNormal.Z)



(User was banned for this post ("Wrong section" - mahalis))

Take out the multiplication with HitNormal.

But now it can’t know which direction it should move.

like:
._____
I…I
I…Z…I —> X
I…I
I…I
.--------
…I
____—> Y

Oh sorry I misunderstood what you want.
[lua]
local size = GhostEntity:OBBMaxs()-GhostEntity:OBBMins()
GridLocation = trace.Entity:GetPos()+trace.HitNormal*trace.HitNormal:Dot(size)
[/lua]
Try that.