Making a CFrame that is orientated to look at a position but is also offset from the center so that orientation is only done around a position?

So as you guys know doing,look) will create a CFrame at pos oriented to look.

I was wondering how you could make a CFrame that is offset from another point that can only rotate around said point but still have it’s lookVector face the look position.

If I do,

while wait() do
	part1.CFrame = *,part0.Size.Y/2,0)).p,target.CFrame.p)

I get the problem which is the part is centered on the offset point(which happens to be the top of another part).
That looks like this:

However, I can do

while wait() do
	part1.CFrame = *,part0.Size.Y/2,0)).p,target.CFrame.p) *,part1.Size.Y/2,0)

This results in something that looks okay:

The problem is because I moved it up the angle is actually off by a little bit:
It’s very little but I was wondering if there is a better method for getting an accurate CFrame?


I am literally trying to solve this exact problem right now for myself.

1 Like

You get any further than me?

1 Like

Multiplying lookvector will keep the rotation, while “moving” the CFrame towards (or backwards if negative)

1 Like

Can you explain this some more I don’t quite get what you mean. What are you supposed to do with lookVectors?

Edit: I know what you mean now but the problem isn’t the rotation is being changed it’s that because the part is being moved up, it no longer points directly at where I intended it too

The system from what I can tell based off what you described is over constrained. Hard to tell without pictures though. They are broken for me.

Rotating around a point locks in all 3 axis of rotation

To demonstrate:

The yellow part here is the center, green is the block you are moving, and red is the target.


If you were to move the green part around the center it would rotate like so:


In order for it look at the target, it would have do something like his:


Which at that point it is no longer rotating around the center part.

You have to first set position, and then make it look towards other part

After like 2 hours of geometry (much longer than this should have taken, but it’s 2:30AM at the time of posting this), I got it working. If you have any questions I’ll answer them tomorrow when the rest of my brain is functional

local part = script.Parent
local base = workspace.Base
local target = workspace.Target
local radius = part.Size.Y/2
local basePos = base.Position +,base.Size.Y/2,0)

while wait() do
    local a = basePos
    local b = target.Position
    local d = (a-b).Magnitude
    local c = a.Y - b.Y
    local B1 = math.acos(c/d)
    local B2 = math.acos(radius/d)
    local angle = math.pi - B1 - B2
    local x = radius * math.sin(angle)
    local y = radius * math.cos(angle)
    local dir =,b.z-a.z).Unit
    local position = basePos +*dir.X,y,x*dir.Y)
    part.CFrame =,b)

Here is the result:


Thanks man.

1 Like