Baseness
|
  |
| Joined: 07 Oct 2015 |
| Total Posts: 1001 |
|
|
| 10 Mar 2016 07:42 PM |
I have a part in Workspace and the camera is offset 10 studs upwards and 10 studs backwards, so how would I make the camera look at the part?
|
|
|
| Report Abuse |
|
|
Baseness
|
  |
| Joined: 07 Oct 2015 |
| Total Posts: 1001 |
|
|
| 10 Mar 2016 07:42 PM |
script:
cam = game.Workspace.CurrentCamera r = game:GetService("RunService") target = game.Workspace.Part cam.CameraSubject = target ang = 0 r.RenderStepped:connect(function() cam.CFrame = CFrame.new(target.Position) * CFrame.Angles(0,ang, 0) * CFrame.new(0,10,10) ang = ang + math.rad(1) end)
|
|
|
| Report Abuse |
|
|
|
| 10 Mar 2016 07:50 PM |
cam.CoordinateFrame = CFrame.new(WorldPosition,LookAtPosition)
-- This should work. |
|
|
| Report Abuse |
|
|
Baseness
|
  |
| Joined: 07 Oct 2015 |
| Total Posts: 1001 |
|
|
| 10 Mar 2016 08:03 PM |
That doesn't work because the camera is being offset by 10 studs upwards and backwards each loop cycle, therefore replacing WorldPosition with cam.CFrame.p would cause an effect that I do not want.
I want it to have that offset, the rotation in radians which adds 1 degree each loop cycle, and to look at the target, which can't figure out how I would do.
|
|
|
| Report Abuse |
|
|
Baseness
|
  |
| Joined: 07 Oct 2015 |
| Total Posts: 1001 |
|
|
| 10 Mar 2016 08:05 PM |
Forget this thread, I've figured it out with trigonometry.
Thanks.
|
|
|
| Report Abuse |
|
|