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: Mat-e-maticas

Previous Thread :: Next Thread 
louiskk is not online. louiskk
Joined: 31 Dec 2008
Total Posts: 228
10 Aug 2015 02:45 PM
Don't suppose anyone knows of a way to make a gun move up and down with the cursor in first person mode?
Report Abuse
IanSplodge is not online. IanSplodge
Joined: 13 Aug 2012
Total Posts: 2686
10 Aug 2015 02:46 PM
Some people to know how to, yes.
Report Abuse
louiskk is not online. louiskk
Joined: 31 Dec 2008
Total Posts: 228
10 Aug 2015 02:48 PM
I know some people do, that's why I'm asking.
Report Abuse
IanSplodge is not online. IanSplodge
Joined: 13 Aug 2012
Total Posts: 2686
10 Aug 2015 02:51 PM
You asked if people knew a way. I answered that.
Report Abuse
louiskk is not online. louiskk
Joined: 31 Dec 2008
Total Posts: 228
10 Aug 2015 02:53 PM
Perhaps if you used common sense you'd realise I wanted an answer to my question, not you telling me that there is someone in our corporeal plane that has the knowledge.
Report Abuse
PearSprite is not online. PearSprite
Joined: 02 Jul 2015
Total Posts: 230
10 Aug 2015 02:56 PM
Step 1: Get player's mouse
Step 2: Get height of screen (obtainable through camera.ViewportSize.h)
Step 3: Get y position of mouse in a move event
Step 4: Use the following formula to get the degrees in radians that you should rotate the tool on the desired axis:

radians = math.rad( 45 ) * ( ( -( camera.ViewportSize.Y / 2 - y ) )/ camera.Viewport.Size.Y )
Report Abuse
PearSprite is not online. PearSprite
Joined: 02 Jul 2015
Total Posts: 230
10 Aug 2015 02:57 PM
Oops, divide by camera.Viewport.Y/2 not camera.Viewport.Size.Y
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
10 Aug 2015 02:58 PM
For first person, you'll be doing everything with the camera's lookvector relative to the x-z plane.
Report Abuse
PearSprite is not online. PearSprite
Joined: 02 Jul 2015
Total Posts: 230
10 Aug 2015 02:58 PM
Also, by camera.Viewport.H I meant camera.Viewport.Y
Report Abuse
louiskk is not online. louiskk
Joined: 31 Dec 2008
Total Posts: 228
10 Aug 2015 02:59 PM
Thanks pear.
Report Abuse
PearSprite is not online. PearSprite
Joined: 02 Jul 2015
Total Posts: 230
10 Aug 2015 02:59 PM
Also my formula only works for when you're not in first person, I'll leave it up to you to convert it.
Report Abuse
PearSprite is not online. PearSprite
Joined: 02 Jul 2015
Total Posts: 230
10 Aug 2015 03:08 PM
Eh, I'll be nice:

radians = math.rad( 45 ) * ( math.acos( mouse.Hit.lookVector:Dot( Vector3.new( 0, 1, 0 ) ) ) / math.pi - .5 )
Report Abuse
PearSprite is not online. PearSprite
Joined: 02 Jul 2015
Total Posts: 230
10 Aug 2015 03:09 PM
Correction:

radians = math.rad( 45 ) * -( math.acos( mouse.Hit.lookVector:Dot( Vector3.new( 0, 1, 0 ) ) ) / math.pi - .5 )
Report Abuse
louiskk is not online. louiskk
Joined: 31 Dec 2008
Total Posts: 228
10 Aug 2015 03:12 PM
Pear, do you know how to get the Y from the mouse in first person?
Report Abuse
PearSprite is not online. PearSprite
Joined: 02 Jul 2015
Total Posts: 230
10 Aug 2015 03:12 PM
^ The mouse is locked in the center of the screen in first person. See the 2nd formula I posted.
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
10 Aug 2015 03:15 PM
@pear Why wouldn't you just use the camera's lookvector?
Report Abuse
PearSprite is not online. PearSprite
Joined: 02 Jul 2015
Total Posts: 230
10 Aug 2015 03:42 PM
^ Because I don't want to have to type camera.CoordinateFrame.lookVector when I can type mouse.Hit.lookVector to do the same thing.
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