Craftero
|
  |
| Joined: 24 Jun 2011 |
| Total Posts: 1451 |
|
|
| 23 Mar 2016 10:38 AM |
How can I make: 1. The Player's camera interpolated from it's current position/view to another certain view-point. For example, when a car is clicked, interpolated to look through the windscreen.
2. The camera go instantly back to the default camera view? For example, when a button is clicked to exit the car, do this.
Any help or advise would be greatly appreciated. |
|
|
| Report Abuse |
|
|
Craftero
|
  |
| Joined: 24 Jun 2011 |
| Total Posts: 1451 |
|
|
| 23 Mar 2016 11:40 AM |
Here's what I've been trying, but it isn't working. At the moment, the camera just freezes and stays still in one position. It doesn't interpolate at all.
local cam = game.Workspace.CurrentCamera cam.CameraType = ("Scriptable") cam:Interpolate(game.Workspace.Part1.CFrame, game.Workspace.Part2..CFrame, 0.5)
Why is this not working as it should? |
|
|
| Report Abuse |
|
|
|
| 23 Mar 2016 11:49 AM |
I'm a little confused here.
Are you trying to make a locked first person perspective from inside of the car when the player is seated?
Camera interpolation is a bit more complicated than it seems. By making it scriptable, it won't just automatically snap to the character relative to where it is, its a bit more than that.
Could you explain a bit more of what you're trying to do?
|
|
|
| Report Abuse |
|
|
Craftero
|
  |
| Joined: 24 Jun 2011 |
| Total Posts: 1451 |
|
|
| 23 Mar 2016 12:30 PM |
So this is what I'm trying to achieve:
I have a window and outside the window is a tree. When you click on the window I want the Player's camera to pan over to the window, so CoordinateFrame = Window.CFrame, and I want the camera to focus on the tree.
I can do this by just changing the CoordinateFrame and the Focus of the Camera, but how do I make the camera will glid/interpolate over to the CFrame of the Window and focus on the tree.
When the Player want's to exit the "Window view", they click an Exit button (which I have already prepared). How can I then make the Camera return to it's default settings, so to speak?
Have I explained this well enough? If I haven't, please just let me know. |
|
|
| Report Abuse |
|
|
Craftero
|
  |
| Joined: 24 Jun 2011 |
| Total Posts: 1451 |
|
|
| 23 Mar 2016 12:31 PM |
| *...camera will glide/interpolate over to.... |
|
|
| Report Abuse |
|
|
Craftero
|
  |
| Joined: 24 Jun 2011 |
| Total Posts: 1451 |
|
|
| 23 Mar 2016 01:06 PM |
Perhaps I should not be using:Interpolate() for this at all? I'm relatively new to camera manipulation, so maybe I've misunderstood the concept.
Should :Interpolate() be used for this?
I would really appreciate any further help or advise. |
|
|
| Report Abuse |
|
|
|
| 23 Mar 2016 02:33 PM |
local Camera = workspace.CurrentCamera
function MoveCamera(Target, Time) local StartTime, Origin = tick(), Camera.CoordinateFrame
repeat Camera.CoordinateFrame = Origin:lerp(Target, math.sin(((tick()-StartTime)/Time)*1.57)) game:GetService("RunService").RenderStepped:wait() until StartTime+Time < tick()
Camera.CoordinateFrame = Target end
This is might be what your looking for? |
|
|
| Report Abuse |
|
|
Craftero
|
  |
| Joined: 24 Jun 2011 |
| Total Posts: 1451 |
|
|
| 23 Mar 2016 04:51 PM |
Thanks KnownEntity, that's exactly what I was trying to do.
I've been playing around with it for a while. I'm now trying to make it work backwards, so to speak, so that when the "Exit" button is pressed, the camera pans back to the default view.
I can't figure out how to do it yet. Have you got any idea? |
|
|
| Report Abuse |
|
|