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.
[code]
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)
[/code]
[highlight](User was banned for this post ("Wrong section" - mahalis))[/highlight]
Take out the multiplication with HitNormal.
[QUOTE=ralle105;27477730]Take out the multiplication with HitNormal.[/QUOTE]
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.
Sorry, you need to Log In to post a reply to this thread.