|
| 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 |
|
|
|
| 19 Jul 2017 03:39 PM |
my friend told me to use
mouse.UnitRay
would that work? |
|
|
| Report Abuse |
|
|
| |
|
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 |
|
|