Xephyric
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 2270 |
|
|
| 24 Jul 2014 08:49 PM |
What is a good way of doing this? PanUnits only pans 45degrees at a time and Tiltunits acts similarly (hence not a smooth movement)
I want my camera to pivot around a point by dragging your mouse while holding down.
Note that the camera to the pivotpoint is 10 (radius) My current method only works to move it left and right and is probably one of the least efficient ways to do it:
*Notes: script.Parent is a Frame with Draggable set to true Method based of a 720-gon with circumradius 10 , interior andlge .5 and side length .087266185694931 Camera has it's angle changed by .5 and then translated .087266185694931
*Script: [[ local cam = Workspace.CurrentCamera monitor = false local angle = .5 local transition = .087266185694931 local strength = 1
script.Parent.DragStopped:connect(function() script.Parent.Position = UDim2.new(.35,0,0,0) monitor = false end)
script.Parent.DragBegin:connect(function() monitor = true x = 0 local room = script.Parent.Parent.Room.Value while monitor do wait() x = script.Parent.Position.X.Offset - x if script.Parent.Position.X.Offset ~= 0 then cam.CoordinateFrame = cam.CoordinateFrame*CFrame.Angles(0,math.rad(angle)*x*strength,0)*CFrame.new(transition*x*strength,0,0) end x = script.Parent.Position.X.Offset end end) ]] |
|
|
| Report Abuse |
|
|
Xephyric
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 2270 |
|
| |
|
Xephyric
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 2270 |
|
| |
|
blockoo
|
  |
| Joined: 08 Nov 2007 |
| Total Posts: 17202 |
|
|
| 24 Jul 2014 10:11 PM |
| I think it would be a lot easier to use the "Attach" camera type. That will take care of up/down rotation, but you you would need your own method to rotate it side to side. You can rotate the part itself to do this (or, if that's not possible, you can make an invisible part inside of the part that the camera is looking at). |
|
|
| Report Abuse |
|
|
Xephyric
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 2270 |
|
|
| 24 Jul 2014 10:12 PM |
| That's a decent idea. I'll look into it, thanks |
|
|
| Report Abuse |
|
|
blockoo
|
  |
| Joined: 08 Nov 2007 |
| Total Posts: 17202 |
|
|
| 24 Jul 2014 10:13 PM |
| Actually, using the "Track" camera type will take care of both types of rotation. The problem is that if the player touches W or S, it zooms in extremely close to the part. |
|
|
| Report Abuse |
|
|
Xephyric
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 2270 |
|
|
| 24 Jul 2014 10:36 PM |
| Actually I kind of liked when I did Attach because i could rotate the part to make the camera turn, however it did not go up and down with he part which i would have liked. When I did Track the camera didnt move at all with the part, so I don't see how it goes with your original idea.? |
|
|
| Report Abuse |
|
|
blockoo
|
  |
| Joined: 08 Nov 2007 |
| Total Posts: 17202 |
|
|
| 24 Jul 2014 10:38 PM |
| With the Track CameraType, you don't need to move the mouse at all. Track allows the user to pan by holding right-click + dragging without being able to zoom. |
|
|
| Report Abuse |
|
|
blockoo
|
  |
| Joined: 08 Nov 2007 |
| Total Posts: 17202 |
|
|
| 24 Jul 2014 10:38 PM |
Typo, oops: "With the Track CameraType, you don't need to move the part at all" |
|
|
| Report Abuse |
|
|
Xephyric
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 2270 |
|
|
| 24 Jul 2014 10:41 PM |
| My plan was to make it gradually slow down after you turn the camera. I'm fairly sure that you cannot do this with roblox's camera, so I was just trying to make it follow the part's CFrame. With Attach I can do this well, except for up and down. |
|
|
| Report Abuse |
|
|
blockoo
|
  |
| Joined: 08 Nov 2007 |
| Total Posts: 17202 |
|
|
| 24 Jul 2014 10:42 PM |
| Oh, so you're going for a sort of "drifting" effect? |
|
|
| Report Abuse |
|
|
Xephyric
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 2270 |
|
|
| 24 Jul 2014 10:45 PM |
Yes. I have the part moving how I want, it's just a matter of finding or creating a good camera to work with it. It may work if I just have it scriptable and set the Cameras CFrame to the same as the part and then transpose it |
|
|
| Report Abuse |
|
|
Xephyric
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 2270 |
|
|
| 24 Jul 2014 10:50 PM |
| It works great with side to side but when i enable up and down it messes up the controls :/ |
|
|
| Report Abuse |
|
|
blockoo
|
  |
| Joined: 08 Nov 2007 |
| Total Posts: 17202 |
|
|
| 24 Jul 2014 10:57 PM |
| I would just go with the Scriptable camera type, then. I have an idea in mind for a more efficient method, but I don't have time to go test it right now. I'll help you out more tomorrow if someone hasn't already. |
|
|
| Report Abuse |
|
|
Xephyric
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 2270 |
|
|
| 24 Jul 2014 10:58 PM |
| Thanks, and congratz on 16000 posts! I'll message you if I don't get it figured out |
|
|
| Report Abuse |
|
|
blockoo
|
  |
| Joined: 08 Nov 2007 |
| Total Posts: 17202 |
|
|
| 24 Jul 2014 10:59 PM |
| Lol, thanks. Too bad I had to ruin it with this xD |
|
|
| Report Abuse |
|
|