Soapy29
|
  |
| Joined: 20 Aug 2009 |
| Total Posts: 653 |
|
|
| 25 Mar 2012 01:31 PM |
| Hello, is there a way I can make a part look the way the camera is looking? Like when the mouse moves right, the camera moves right and the parts also moves right. |
|
|
| Report Abuse |
|
|
Soapy29
|
  |
| Joined: 20 Aug 2009 |
| Total Posts: 653 |
|
|
| 25 Mar 2012 01:51 PM |
Bump
I think you have to use a local script. |
|
|
| Report Abuse |
|
|
Soapy29
|
  |
| Joined: 20 Aug 2009 |
| Total Posts: 653 |
|
|
| 25 Mar 2012 02:07 PM |
Bump
I think you have to use the mouse hit function, but how do you use it? |
|
|
| Report Abuse |
|
|
|
| 25 Mar 2012 02:37 PM |
Well, you'd need to use a local script. Take the lookvector of the coordinate frame of the camera, and set the parts CFrame to something like the following:
part.CFrame = CFrame.new(part.Position, part.Position+cameralookvector)
Sincerely, Noobertuber |
|
|
| Report Abuse |
|
|
Soapy29
|
  |
| Joined: 20 Aug 2009 |
| Total Posts: 653 |
|
|
| 25 Mar 2012 02:40 PM |
I knew I needed to use lookvector, but how do I get it?
So, something like this?
cam=workspace.CurrentCamera part=workspace.Part while true do part.CFrame = CFrame.new(part.Position, part.Position+cameralookvector) wait() end |
|
|
| Report Abuse |
|
|
|
| 25 Mar 2012 02:44 PM |
You're doing it wrong.
local cam = workspace.CurrentCamera local cf = cam.CoordinateFrame local foc = cam.Focus local p = Instance.new("Part") p.Parent = workspace p.CFrame = CFrame.new(cf.p,foc.p)
|
|
|
| Report Abuse |
|
|
|
| 25 Mar 2012 02:49 PM |
Here's what you want, there are some flaws in my previous code:
local cam = workspace.CurrentCamera local cf = cam.CoordinateFrame local foc = cam.Focus local p = Instance.new("Part") p.Anchored = true p.FormFactor = ("Custom") p.Size = Vector3.new(1,1,1) p.Parent = workspace while wait() do p.CFrame = CFrame.new(cf.p,foc.p) end |
|
|
| Report Abuse |
|
|
Soapy29
|
  |
| Joined: 20 Aug 2009 |
| Total Posts: 653 |
|
|
| 25 Mar 2012 02:52 PM |
Thanks. I modified it a bit. But can I do this with the players head?
local cam = workspace.CurrentCamera local cf = cam.CoordinateFrame local foc = cam.Focus p = workspace.Head
while true do local cf = cam.CoordinateFrame local foc = cam.Focus p.CFrame = CFrame.new(cf.p,foc.p) p.Position=Vector3.new(0,20,0) wait() end |
|
|
| Report Abuse |
|
|
|
| 25 Mar 2012 02:56 PM |
Moving the head of a player will probably kill him/her. Here's how you would instead do: --Assuming you have the localscript inside the player's character: local cam = workspace.CurrentCamera local torso = script.Parent:FindFirstChild("Torso") local cf local foc while wait() do cf = cam.CoordinateFrame foc = cam.Focus torso.CFrame = CFrame.new(cf.p,foc.p) * CFrame.new(0,-3.2,0) end |
|
|
| Report Abuse |
|
|
|
| 25 Mar 2012 02:58 PM |
| You could use the neck 6D motor. |
|
|
| Report Abuse |
|
|
Soapy29
|
  |
| Joined: 20 Aug 2009 |
| Total Posts: 653 |
|
| |
|
Soapy29
|
  |
| Joined: 20 Aug 2009 |
| Total Posts: 653 |
|
|
| 25 Mar 2012 03:03 PM |
| MasterAni, that script makes you fly everywhere. You can't move the head, but if you did, it would kill you. |
|
|
| Report Abuse |
|
|
Soapy29
|
  |
| Joined: 20 Aug 2009 |
| Total Posts: 653 |
|
|
| 25 Mar 2012 03:04 PM |
| thek00lkid said something about a neck 6D motor? |
|
|
| Report Abuse |
|
|
|
| 25 Mar 2012 03:13 PM |
| Uh, I thought I made it clear that moving the head would cause you to die? Hence the reason why I switched to torso. I don't need you to tell me that. I know it makes you fly everywhere. How about sticking to making a single part you create follow the camera instead? The neck 6D motor is basicly the same as a weld, only difference is that a 6D motor can be used for animations without killing the character. |
|
|
| Report Abuse |
|
|
Soapy29
|
  |
| Joined: 20 Aug 2009 |
| Total Posts: 653 |
|
|
| 25 Mar 2012 03:14 PM |
| Could I use the Motor6D with just the head to move the head around and not kill the person? |
|
|
| Report Abuse |
|
|
| |
|
Soapy29
|
  |
| Joined: 20 Aug 2009 |
| Total Posts: 653 |
|
|
| 25 Mar 2012 03:28 PM |
| So would it be the same script, but instead of the cFrame, I should replace it with Motor6D instead? |
|
|
| Report Abuse |
|
|
|
| 25 Mar 2012 03:30 PM |
| No, you find out where the camera is pointing, and set the motor's desired angle to where you calculate the camera is pointing. |
|
|
| Report Abuse |
|
|
Soapy29
|
  |
| Joined: 20 Aug 2009 |
| Total Posts: 653 |
|
|
| 25 Mar 2012 03:39 PM |
| I don't know what I am doing... It's not working. |
|
|
| Report Abuse |
|
|
Soapy29
|
  |
| Joined: 20 Aug 2009 |
| Total Posts: 653 |
|
| |
|
Soapy29
|
  |
| Joined: 20 Aug 2009 |
| Total Posts: 653 |
|
| |
|
|
| 25 Mar 2012 04:40 PM |
| Look up camera on the wiki. |
|
|
| Report Abuse |
|
|
Soapy29
|
  |
| Joined: 20 Aug 2009 |
| Total Posts: 653 |
|
|
| 25 Mar 2012 05:11 PM |
| What I had working before doesn't work in multiplayer. Does anyone know why? I have almost redone it all. You can see it at my head test game. The head doesn't move like it should. |
|
|
| Report Abuse |
|
|
Soapy29
|
  |
| Joined: 20 Aug 2009 |
| Total Posts: 653 |
|
|
| 25 Mar 2012 05:26 PM |
Why doesn't the CFrame part work in multiplayer? This is the part that doesn't work in multiplayer:
cam = workspace.CurrentCamera cf = cam.CoordinateFrame foc = cam.Focus
p = script.Parent cam.CameraSubject=p cam.CameraType="Follow"
while true do cf = cam.CoordinateFrame foc = cam.Focus p.CFrame = CFrame.new(cf.p,foc.p)
... |
|
|
| Report Abuse |
|
|
Soapy29
|
  |
| Joined: 20 Aug 2009 |
| Total Posts: 653 |
|
| |
|