 # Make something point at a vector using ApplyForceOffset

Iw as wondering how I would go about doing this as I cannot work it out. I would just like to set a point and have the entity point at it. Thanks.

Look at the code in the Melonracer gamemode. It has a similar effect used to point people towards the next goal on the racetrack.
I would post the code for you but I do not have Gmod at hand.

Why don’t you get the vector between the point and the entity, then get the vector’s angle and set the entity’s angle to that angle.

The problem I have is setting it to an angle at all, using applyforceoffset.

I don’t want to use SetAngles(), that’s my point.

So you want the Entity to look like it is turning towards that angle?

I don’t want it to look like it is, I want it to be doing that not just giving that illusion.

See if you can get anything from this:
local oAng = entity:GetPos() --entity is the entity you want to turn.
local nAng = (point - entity:GetPos()):Angle() --point is a vector of the point you want the entity to turn to
local p = math.ApproachAngle(oAng.p, nAng.p, math.AngleDifference(oAng.p, nAng.p)2FrameTime())
local y = math.ApproachAngle(oAng.y, nAng.y, math.AngleDifference(oAng.y, nAng.y)2FrameTime())
local r = math.ApproachAngle(oAng.r, nAng.r, math.AngleDifference(oAng.r, nAng.r)2FrameTime())
entity:SetAngles(Angle(p, y, r))
end)[/lua]

It’s a bit more complicated than you would think. The setangles way is probably the easiest, but a shadow controller is easy too.

This may be a stupid question but, what is a shadow controller? I am a complete noob but it is intruiging.

You give it variables, it goes to the location and points where you want it. It’s extremely powerful, but you can’t do much else, so it’s questionably useful.

Wow the name alone sounds cool! Thanks for the info! and Merry Christmas!