Positioning Problems Vector3

So I have an NPC Chat System thing so I make the camera scriptable and then tween it the positon i want it to be add problem is Im trying to make tween it to the head and y and z are working fine but I cant get x to function correctly

Heres some of the code :

v.Head.CFrame * CFrame.Angles(0,-math.rad(180),0) + Vector3.new(-v.Head.Position.X,0,333 + v.Head.Position.Z)

Do you really need that - sign. I think removing it may solve the issue.

333 is a really large number.

I tried removing it and it didnt work let me try again and get back to you

This will position the camera in front of your npcs head. All I did was get the position of the head + the lookvector, then make the focus the heads position.

Camera.CFrame = CFrame.new(Head.Position + Head.CFrame.lookVector*2, Head.Position)

You can then adjust the position as you want.

Alright let me try this real quick

In case you don’t know how to adjust the X position you can do this.

local XPos = Vector3.new(-1,0,0)
Camera.CFrame = CFrame.new((Head.Position + XPos) + Head.CFrame.lookVector*4, Head.Position + XPos)

This will position the dummy to the left of the camera, so your frame can display. You can increase the lookvector to move the dummy more outwards so it displays better too.

1 Like

Alright ill try this right now

Thank you it works flawlessly
[30 Characters]

No problem! Glad to see the script worked for you.

1 Like

Mind telling me how you are so good with Vector3s and stuff Im very bad at them and would love to improve

It took a while for me to understand, but I realized X,Y,Z is Left/Right, Up/Down, and Forwards/Backwards. Once you know that, getting the position of the head and adjusting the coordinates is pretty simple. You let roblox do the work for you with the position property, and adjust the coordinates at your will knowing what will happen.

Also I look at part properties to find what’s useful for positioning. It’s all about experience.

1 Like

Alright ill keep that in mind for future reference thanks for explaining it

1 Like