|
| 17 Jul 2016 10:57 AM |
I'm trying to make a script that has the camera rotate around the part. When you rotate you are rotating around the part and not basically first person in the part. I was wondering how I would do this. Here is my script so far although it doesn't really do what I want it to.
local target = game.Workspace.Plot.Plot local Camera = game.Workspace.CurrentCamera
Camera.CameraSubject = target Camera.CameraType = "Scriptable"
local angle = 0
while wait() do Camera.CoordinateFrame = CFrame.new(target.Position) * CFrame.Angles(0,angle,0) angle = angle + math.rad(1) end
|
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 11:04 AM |
you'd need to do something like theees.
local target = workspace.Plot.Plot local cam = workspace.CurrentCamera
cam.CameraSubject = target cam.CameraType = "Scriptable"
local angle = 0 local speed = 50
while true do angle=angle+(game:GetService("RunService").RenderStepped:wait()*speed) cam.CFrame = target.CFrame * CFrame.Angles(0,math.rad(angle),0) * CFrame.new(0,0,10) end |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 11:11 AM |
Is there a way to make it rotate around a part? So the camera is going around the part although the camera is pointed at the part?
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 17 Jul 2016 11:43 AM |
What your script does is makes the camera go around a part but does not look at the part. What I want is a script that goes in a circle around a part and looking at it sort of like a 3rd person 360 shot.
|
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 11:46 AM |
It does look at the part. That's what i've tested.
Is the part you're targetting too big? then just increase the "10" to whatever larger size you want it to be. |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 11:50 AM |
Nevermind. It works. Thank you. Is there a way I can tilt the camera?
|
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 11:52 AM |
| Yes in CFrame.Angles just change the 0s in there. It'll affect the angle of the camera starting out. |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 11:54 AM |
@Speedy
There's a function now that can smoothly tween camera movement and rotation.
void Interpolate ( CFrame endPos, CFrame endFocus, float duration )
A friend actually told me about this :P. |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 11:55 AM |
| @secret6timb1 I already know about that function, but there was a lot of troubles back in the day regarding its 'functionality' so I just code it all myself. |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 11:57 AM |
Ah, Lel, 'Function', 'Functionality', play on words.
Actually going to save this forum or part's of it in-case I run into problems in the future. |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 12:00 PM |
Yes not too long ago the Interpolation was completely broken and didn't work for anybody. I ended up having to create my own function with workspace.CurrentCamera.CFrame:lerp(cf2) in it.
And now I just don't trust it. |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 12:04 PM |
"Ah, Lel, 'Function', 'Functionality', play on words."
Not really, it's just the proper word to use in that situation.
I haven't tried that function recently, but it used to not be implemented. |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 12:07 PM |
@TheGray
You're no fun :c.
I haven't used any camera interpolation yet.
I'll just use whichever is most optimal when I get to it. |
|
|
| Report Abuse |
|
|