Scriptos
|
  |
| Joined: 17 Jun 2008 |
| Total Posts: 2900 |
|
|
| 20 Feb 2014 05:38 PM |
I'm having trouble with making the arrow (which is in the center of my minimap) rotate with the camera.
It rotates fine until my camera points south. The arrow never faces south, but rather only moves left and right.
How would I make it rotate with the camera direction?
This is what I've attempted;
script.Parent.Frame.Dot.Arrow.Rotation = math.deg(workspace.CurrentCamera.CoordinateFrame.lookVector.X); |
|
|
| Report Abuse |
|
|
Scriptos
|
  |
| Joined: 17 Jun 2008 |
| Total Posts: 2900 |
|
|
| 20 Feb 2014 05:44 PM |
If you need to see the minimap to get a better idea of what I'm doing, go here.
http://www.roblox.com/Dimicor-Isle-of-Fincayra-Pre-Alpha-place?id=23242073
The arrow image isn't there yet, but I'd really like to add it. Which is why I'm asking for help here. |
|
|
| Report Abuse |
|
|
Scriptos
|
  |
| Joined: 17 Jun 2008 |
| Total Posts: 2900 |
|
| |
|
BEART12
|
  |
| Joined: 22 Oct 2008 |
| Total Posts: 3190 |
|
|
| 20 Feb 2014 06:16 PM |
| A very cool concept idea i was going to make one of these but to point to a brick in workspace like a waypoint, in like a week ill see if i can make one if i do i will post or send the script to you |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 20 Feb 2014 06:18 PM |
local x,y,z = workspace.CurrentCamera.CoordinateFrame:toEulerAnglesXYZ()
script.Parent.Frame.Dot.Arrow.Rotation = math.degree(-- It's either x,y, or z ) |
|
|
| Report Abuse |
|
|
Scriptos
|
  |
| Joined: 17 Jun 2008 |
| Total Posts: 2900 |
|
| |
|
BEART12
|
  |
| Joined: 22 Oct 2008 |
| Total Posts: 3190 |
|
|
| 20 Feb 2014 07:17 PM |
Here man, dont happen to know how to point it to a direction do you?
Mouse.Move:connect(function() Player.PlayerGui.Arrow.Frame.Rotation = math.deg( Game.Workspace.CurrentCamera.CoordinateFrame:toEulerAnglesXYZ()) end) |
|
|
| Report Abuse |
|
|
Scriptos
|
  |
| Joined: 17 Jun 2008 |
| Total Posts: 2900 |
|
|
| 20 Feb 2014 07:22 PM |
That still doesn't work.
It points correctly when I look left, but it never points right now. |
|
|
| Report Abuse |
|
|
Bokken
|
  |
| Joined: 10 Jan 2010 |
| Total Posts: 194 |
|
|
| 20 Feb 2014 07:35 PM |
As posted in your other thread,
"Camera.CoordinateFrame.lookVector:Dot(Vector3.new(-0, -0, -1))
Convert the above to degs and boom." |
|
|
| Report Abuse |
|
|
Scriptos
|
  |
| Joined: 17 Jun 2008 |
| Total Posts: 2900 |
|
|
| 20 Feb 2014 07:39 PM |
@Bokken;
That seems to work the same way my first attempt did.
It points left, right, and north, but it nevers seems to point south, even though my camera is facing that direction. |
|
|
| Report Abuse |
|
|
Bokken
|
  |
| Joined: 10 Jan 2010 |
| Total Posts: 194 |
|
|
| 20 Feb 2014 07:39 PM |
| Did you convert it to degrees? |
|
|
| Report Abuse |
|
|
Bokken
|
  |
| Joined: 10 Jan 2010 |
| Total Posts: 194 |
|
|
| 20 Feb 2014 07:41 PM |
| math.deg(game.Workspace.CurrentCamera.CoordinateFrame.lookVector:Dot(Vector3.new(-0, -0, -1)) * math.pi) |
|
|
| Report Abuse |
|
|
Scriptos
|
  |
| Joined: 17 Jun 2008 |
| Total Posts: 2900 |
|
|
| 20 Feb 2014 07:47 PM |
inspiredArbitrator solved this for me.
If anyone's curious, this works;
local sx, sy, sz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = Workspace.CurrentCamera.CoordinateFrame:components()
heading = math.deg(math.atan2(m02, m22));
script.Parent.Frame.Dot.Arrow.Rotation=-heading; |
|
|
| Report Abuse |
|
|