generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Camera Manipulation question

Previous Thread :: Next Thread 
Baseness is not online. 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 is not online. 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
xSpectrumWolfx is not online. xSpectrumWolfx
Joined: 30 Nov 2011
Total Posts: 2858
10 Mar 2016 07:50 PM
cam.CoordinateFrame = CFrame.new(WorldPosition,LookAtPosition)

-- This should work.
Report Abuse
Baseness is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image