|
| 31 May 2015 05:14 PM |
| how do i raycast my mouse to point to my mouse x and y position |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 31 May 2015 05:39 PM |
local Workspace = game.Workspace; local player = game.Players.LocalPlayer; local service = game:GetService("UserInputService"); local rad = math.rad; local Max = 180; local cRotation = 0; service.InputChanged:connect(function(IO) local delta = IO.Delta; local character = player.Character; local arm = character.Torso["Right Shoulder"]; if not(cRotation > Max or cRotation + (-delta.Y) > Max) then cRotation = cRotation + (-delta.Y); print(cRotation, Max); arm.C0 = arm.C0 * CFrame.Angles(0, 0, -rad(delta.Y)); end; end);
There you go. |
|
|
| Report Abuse |
|
|
|
| 31 May 2015 05:45 PM |
Actually since you won't know how to make it work for both arms: local Workspace = game.Workspace; local player = game.Players.LocalPlayer; local service = game:GetService("UserInputService"); local rad = math.rad; local Max = 180; local cRotation = 0; service.InputChanged:connect(function(IO) local delta = IO.Delta; local character = player.Character; local arm = character.Torso["Right Shoulder"]; local arm2 = character.Torso["Left Shoulder"]; if not(cRotation > Max or cRotation + (-delta.Y) > Max) then cRotation = cRotation + (-delta.Y); local rotate = CFrame.Angles(0, 0, -rad(delta.Y)); arm.C0 = arm.C0 * rotate arm2.C0 = arm2.C0 * rotate:inverse() end; end);
Doesn't work with filtering; most use LockFirstPerson. |
|
|
| Report Abuse |
|
|
|
| 31 May 2015 05:45 PM |
| i am srry i did not want it to work like a zoomed in scope i wanted it to make my arms point where my mouse is for instance my mouse points at a block i want my hand to point at it |
|
|
| Report Abuse |
|
|
|
| 31 May 2015 05:51 PM |
| Given this is in first person your body moves where you mouse does so, it should work for that. |
|
|
| Report Abuse |
|
|
|
| 31 May 2015 05:54 PM |
| dude it only works on y index what about z and x |
|
|
| Report Abuse |
|
|
|
| 31 May 2015 06:11 PM |
| Listen to what I said above. Your body turns with the camera in LockFirstPerson. Z and X are taken care of by default. |
|
|
| Report Abuse |
|
|
OKevinO
|
  |
| Joined: 05 May 2010 |
| Total Posts: 1036 |
|
|
| 31 May 2015 06:36 PM |
| Lets just say he wants it to work in 3rd person... |
|
|
| Report Abuse |
|
|
| |
|