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's lookvector

Previous Thread :: Next Thread 
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
19 Jul 2015 04:53 AM
I need a part to be constantly facing the mouses direct using CFrame

I need to do this with two parts, one part will ONLY turn side to side, the other will ONLY go face up and down.

I don't normally use lookvector on a mouse so yeah :/

I only want to change the cframe not rotation or anything.

Thanks, Barb
Report Abuse
jasondee1 is not online. jasondee1
Joined: 26 Jul 2008
Total Posts: 8002
19 Jul 2015 04:55 AM
Mouse.Origin?

http://wiki.roblox.com/index.php?title=API:Class/Mouse/Origin


Godspeed
Report Abuse
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
19 Jul 2015 05:01 AM
@jasondee

'CFrame positioned at the Player's camera and oriented toward where the mouse is pointed in the game world.'

hmm, may i have an example see i don't really see where i would use this, i need to learn coodinateframe as well.

I know you don't like writing code for people so don't, please give me an article or tell me where i'd use this

Thanks, Barb
Report Abuse
jasondee1 is not online. jasondee1
Joined: 26 Jul 2008
Total Posts: 8002
19 Jul 2015 06:38 AM
Sorry for the late reply.

coordinateframe is CFrame. You said you need a part to be constantly facing the mouse's direct location using CFrame. Mouse.Origin returns the mouses location relative to the game world in CFrame

So you would get the mouse's location like so:

blah.CFrame = CFrame.new(playermouse.Origin)

of course you would need to get the player's mouse first.


Godspeed
Report Abuse
jasondee1 is not online. jasondee1
Joined: 26 Jul 2008
Total Posts: 8002
19 Jul 2015 06:39 AM
"So you would get the mouse's location like so:"

I mean't set a part to the mouse's orientation.

I haven't used it before so...


Godspeed
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
19 Jul 2015 08:25 AM
mouse.Hit.lookVector and atan2 and asin
If I'm assuming what you want correctly.
Report Abuse
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
19 Jul 2015 10:35 AM
bump

Thanks tons but one more thing, how would I limit it to ONLY up and down or ONLY side to side?

P.S. I came up with a signature :D

~ Don't show me the answer, tell me.
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
19 Jul 2015 10:39 AM
local part1
local part2
local mouse = game.Players.LocalPlayer:GetMouse()

game:GetService("RunService").RenderStepped:connect(function()
local p = mouse.Hit.p
part1.CFrame = CFrame.new(part1.Position, Vector3.new(p.x,part1.Position.y,p.z))
part2.CFrame = CFrame.new(part2.Position, part2.Position.x,p.y,part2.Position.z)
end)

part1 is side 2 side
part2 is up/down

probably wrong but yolo
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
19 Jul 2015 10:39 AM
part2.CFrame = CFrame.new(part2.Position, Vector3.new(part2.Position.x,p.y,part2.Position.z))

ye
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