|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|