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: Can you find any errors in this code?

Previous Thread :: Next Thread 
RubiksCubix is not online. RubiksCubix
Joined: 04 Dec 2009
Total Posts: 4243
14 Jul 2012 03:01 PM

if (toolAnim == "None") then --my cursor follow arm addition
Cursor_Position = math.abs(mouse.Hit.Position)
Arm_x = math.abs(Torso.Position.X - Cursor_Position.X)
Arm_Y = math.abs(Torso.Position.y - Cursor_Position.y)
Arm_Distance = (Arm_x * Arm_x) + (Arm_Y * Arm_Y)
Shot_Length = math.sqrt(Arm_Distance)
Arm_Z = math.abs(Cursor_Position.Z - Torso.Position.Z)
Arm_Turn = Arm_Z/Shot_Length
Arm_Angle = > = math.tan(Arm_Turn)
RightShoulder.DesiredAngle = Arm_Angle
return
end


This is my substitute for the tool arm angle in the character animation script to make it follow your cursor up and down. Please find any errors for me! :)
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
14 Jul 2012 03:04 PM
Output?
Report Abuse
RubiksCubix is not online. RubiksCubix
Joined: 04 Dec 2009
Total Posts: 4243
14 Jul 2012 03:21 PM
RightShoulder.DesiredAngle = 1.57

This is the typical tool activation function. I'm finding the cursor height and distance so I can calculate the angle the arm should be at so in first person the arm follows the cursor. I was wondering, hoever, if there would be a specific conversion factor to convert the angle to roblox angles, because the starting angle was 1.57, not 90. Perhaps subtraction? Or maybe division? Please help!
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
14 Jul 2012 03:23 PM
I have a feeling you don't know the math you're using.

I'll be frank;
I know very little. (Grade 8 doesn't teach you very much).
Report Abuse
leo12345678900 is not online. leo12345678900
Joined: 08 May 2011
Total Posts: 43
14 Jul 2012 03:24 PM
LOL NOOBS!
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
14 Jul 2012 03:26 PM
nope.avi
Report Abuse
RubiksCubix is not online. RubiksCubix
Joined: 04 Dec 2009
Total Posts: 4243
14 Jul 2012 03:39 PM
Lol I just got done with eight grade too. I know what you mean. I have quite a few good friends and hard schooling, so regardless of whether I want it to or not, roblox almost always comes last. Please though! Anyone else that can help!
Report Abuse
RubiksCubix is not online. RubiksCubix
Joined: 04 Dec 2009
Total Posts: 4243
14 Jul 2012 03:40 PM
I looked up an online lua library, thats how i got the functions and operations!
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