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 » Scripters
Home Search
 

Re: Get mouse direction?

Previous Thread :: Next Thread 
DannyJesden112 is not online. DannyJesden112
Joined: 15 Jan 2017
Total Posts: 229
19 Jul 2017 03:27 PM
Hello,

I want to make a function when my mouse clicks on a part (Size = 2,2,2) I want to get the direction it is pointing on the part (in x,y,z).


I tried it with TargetSurface but it isn't what I search, because some parts are rotated.


Example what I mean :D


Y
| X [Part] <- O.O [me]
|/
|----Z

I want to get like a result that I look from the Z axis.


----

some locals:

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

mouse.Button1Down:connect(function()

end
Report Abuse
DannyJesden112 is not online. DannyJesden112
Joined: 15 Jan 2017
Total Posts: 229
19 Jul 2017 03:39 PM
my friend told me to use

mouse.UnitRay

would that work?
Report Abuse
DannyJesden112 is not online. DannyJesden112
Joined: 15 Jan 2017
Total Posts: 229
19 Jul 2017 04:13 PM
anyone? (bump)
Report Abuse
vastqud is not online. vastqud
Joined: 10 Sep 2011
Total Posts: 2464
19 Jul 2017 04:46 PM
yes mouse.UnitRay is a ray, and that ray's origin is the position of the player's camera and the direction is a unit vector in the direction of where the mouse is pointing

http://wiki.roblox.com/index.php?title=API:Class/Mouse/UnitRay


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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