TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 07 Aug 2016 11:22 AM |
How would I calculate how the camera moves from 1 point to another without changing the Y coodinate?
atm this is what im trying to do:
http://prntscr.com/c2q4p3
And I tried do this:
while true do cam.CoordinateFrame = cam.CoordinateFrame * CFrame.new(-1,0,-1) end
However, the camera goes down and the left if i do that.
However when i do the other way the camera moves exactly how i want it to:
cam.CoordinateFrame = cam.CoordinateFrame * CFrame.new(-1,0,0)
it moves to the left perfectly and...
How would i replicate this desired effect?
|
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 07 Aug 2016 11:23 AM |
sorry wrong picture
http://prntscr.com/c2q66i
|
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 07 Aug 2016 11:33 AM |
i sorta solved the problem..but now i need exact values
cam.CoordinateFrame = CFrame.new(cam.CoordinateFrame.X+.1,cam.CoordinateFrame.Y,cam.CoordinateFrame.Z+.1)
ill probably just get a ratio or something
|
|
|
| Report Abuse |
|
|
|
| 07 Aug 2016 11:34 AM |
When multiplying a CFrame by another CFrame you're moving it in local space.
You should just be able to add a vector3 of (1, 0, 1) or (-1, 0, -1) to get the desired result. |
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 07 Aug 2016 11:36 AM |
CFrame:lerp returns a CFrame between two points at the given alpha, so you could do
for i = 1, 10 do local lcframe = cam.CFrame:lerp(goalPoint, i/10) cam.CFrame = CFrame.new(lcframe.X, 0.5, lcframe.Z) wait(time/10) end
where goalPoint is the goal point and time is the amount of time for it to move. |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 07 Aug 2016 11:39 AM |
Kodran, I knew someone would post a tweening solution, however the problem is that the goal point in this context is undefined. I just want to move the camera in that general direction exactly.
|
|
|
| Report Abuse |
|
|
|
| 07 Aug 2016 11:44 AM |
| No feedback on my answer? Is it what you wanted? Are you looking for something else? |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 07 Aug 2016 11:45 AM |
Sorry for not replying toon. I'm trying your method atm. I will post my result after the matter.
|
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 07 Aug 2016 11:48 AM |
Ah toon. that exactly what I was looking for. I forgot you could add and subtract vector from cframe...I've always done
cframe * cframe.new()
Thank you
|
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 07 Aug 2016 11:48 AM |
Well you could make it go passed alpha 1
Or do something like this:
cam.CFrame = whitePart.CFrame local x = (blackPart.CFrame.X-cam.CFrame.X)/10 local z = (blackPart.CFrame.Z-cam.CFrame.Z)/10
while wait() do cam.CFrame = cam.CFrame * CFrame.new(x, 0, z) end |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 07 Aug 2016 11:49 AM |
wever now I need find the exact values for the position.
for example,
Vector3.new(-1,0,-1) moves the camera slighty more to the left from the direction i want it to go.
|
|
|
| Report Abuse |
|
|
|
| 07 Aug 2016 11:50 AM |
| Are you making a top down camera isometric type camera? I think I have a different solution if you are. |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 07 Aug 2016 11:51 AM |
@kodran im sure that would work but now, im using vector3.new so i can keep the current rotation of the camera
|
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 07 Aug 2016 11:52 AM |
okay fine you caught me. Yes i was trying to do that. Like this camera in civ3
http://prnt.sc/c2qhm0
|
|
|
| Report Abuse |
|
|
|
| 07 Aug 2016 11:57 AM |
Alright then.
A solution might be to have the camera kind of track the camera position on the "floor".
camRot = CFRame.Angles(0, 0, 0) --A constant variable storing the isometric rotation cP = CFrame.new(x, 0, z) --the position on the floor zoom = 5 --distance camera is from cP
CP*camRot*CFrame.new(0, 0, zoom) --may have to play with how zoom is applied, it should be on the z axis, maybe negative though (for backwards)
Then just move cP or even lerp it :) |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 07 Aug 2016 12:00 PM |
but i figured it out. Thanks for all your help!
|
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 07 Aug 2016 12:02 PM |
thanks toon. that look like a good option aswell
|
|
|
| Report Abuse |
|
|
|
| 07 Aug 2016 12:08 PM |
like this? (press Y to unlock camera)
https://www.roblox.com/games/471452989/DreamsWorks-Place-Number-28
|
|
|
| Report Abuse |
|
|
|
| 07 Aug 2016 12:09 PM |
| I don't think that's it, since as he said, he doesn't really have a "target" like you do. (the players head) |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2016 12:10 PM |
Thats why I said to unlock the camera, it ignores the target
|
|
|
| Report Abuse |
|
|