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: Mouse Raycasting

Previous Thread :: Next Thread 
deadly3652 is not online. deadly3652
Joined: 17 Nov 2011
Total Posts: 268
31 May 2015 05:14 PM
how do i raycast my mouse to point to my mouse x and y position
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
31 May 2015 05:17 PM
Use Mouse.Hit.
Report Abuse
deadly3652 is not online. deadly3652
Joined: 17 Nov 2011
Total Posts: 268
31 May 2015 05:18 PM
i ment to move my arms
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
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
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
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
deadly3652 is not online. deadly3652
Joined: 17 Nov 2011
Total Posts: 268
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
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
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
deadly3652 is not online. deadly3652
Joined: 17 Nov 2011
Total Posts: 268
31 May 2015 05:54 PM
dude it only works on y index what about z and x
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
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 is not online. 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
deadly3652 is not online. deadly3652
Joined: 17 Nov 2011
Total Posts: 268
13 Jun 2015 09:28 PM
Exactly
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