generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Minimap player arrow rotation

Previous Thread :: Next Thread 
Scriptos is not online. 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 is not online. 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 is not online. Scriptos
Joined: 17 Jun 2008
Total Posts: 2900
20 Feb 2014 06:03 PM
Bump.
Report Abuse
BEART12 is not online. 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 is not online. 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 is not online. Scriptos
Joined: 17 Jun 2008
Total Posts: 2900
20 Feb 2014 07:04 PM
Doesn't work.
Report Abuse
BEART12 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. Bokken
Joined: 10 Jan 2010
Total Posts: 194
20 Feb 2014 07:39 PM
Did you convert it to degrees?
Report Abuse
Bokken is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image