drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 21 Oct 2013 04:52 PM |
How would I make the gun follow the player's camera or whatever, like when you look upwards, then gun follows where you look? I honestly can't figure it out.
When life gives you lemons, Squirt 'em in your eyes. - Drahsid5 |
|
|
| Report Abuse |
|
|
|
| 21 Oct 2013 04:56 PM |
| I weld the arms to the head and whenever the mouse.Move event fires I adjust the head weld accordingly. |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 21 Oct 2013 05:02 PM |
Ok, so would I do somthing like
local function updateMove()
local Player = game.Players.LocalPlayer local Char = Player.Character
w1 = Instance.new("ManualWeld", Char) w2 = Instance.new("ManualWeld", Char) w1.Part0 = Char.Head w1.Part1 = Char["Left Arm"] w2.Part0 = Char["Right Arm"] w2.Part1 = Char.Head
MouseMoved:connect()
When life gives you lemons, Squirt 'em in your eyes. - Drahsid5 |
|
|
| Report Abuse |
|
|
|
| 21 Oct 2013 05:09 PM |
No do this
local weld = --newWeldHere
function updateWeld() weld.C0 = --find angle here end
mouse.Moved:connect(updateWeld) |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 21 Oct 2013 05:11 PM |
how do I find the angle? I'm never good with that kinda' stuff. =p
When life gives you lemons, Squirt 'em in your eyes. - Drahsid5 |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 21 Oct 2013 05:23 PM |
atm I got:
local Player = game.Players.LocalPlayer Player:GetMouse(mouse) local weld = Instance.new("Weld", script.Parent)
function updateWeld() weld.C0 = 0 end
mouse.Moved:connect(updateWeld)
When life gives you lemons, Squirt 'em in your eyes. - Drahsid5 |
|
|
| Report Abuse |
|
|
|
| 21 Oct 2013 05:26 PM |
Well, after you figure out how to move your head, Get the lookVector.
|
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 21 Oct 2013 05:28 PM |
now I got
local Player = game.Players.LocalPlayer mouse = Player:GetMouse() local weld = Instance.new("Weld", script.Parent) weld.Part0 = -- Would I do a player arm or the gun??? weld.Part1 = -- Would I do a player arm or the gun???
function updateWeld() weld.C0 = mouse.Y end
mouse.Moved:connect(updateWeld)
When life gives you lemons, Squirt 'em in your eyes. - Drahsid5 |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 21 Oct 2013 05:41 PM |
and now:
local camera = workspace.CurrentCamera local Player = game.Players.LocalPlayer mouse = Player:GetMouse() local weld = Instance.new("Weld", script.Parent)
weld.Part0 = Player.Character["Left Arm"] weld.Part1 = Player.Character["Right Arm"]
function updateWeld() weld.C0 = mouse.Hit.p end
mouse.Moved:connect(updateWeld)
the output says : 18:40:15.879 - Moved is not a valid member of PlayerMouse ... the mouse can't move? ...
When life gives you lemons, Squirt 'em in your eyes. - Drahsid5 |
|
|
| Report Abuse |
|
|
|
| 21 Oct 2013 05:45 PM |
maybe
Mouse.Changed
so it will happen whenever you do anything with the mouse. that is the idea, a constant update right? |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 21 Oct 2013 05:48 PM |
Ok, mouse.changed made no error in the output come up. c: now I need to figure out all dat angle stuff.
When life gives you lemons, Squirt 'em in your eyes. - Drahsid5 |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 21 Oct 2013 06:47 PM |
bump
When life gives you lemons, Squirt 'em in your eyes. - Drahsid5 |
|
|
| Report Abuse |
|
|
|
| 21 Oct 2013 06:54 PM |
hmm. maybe i'll give it a shot. only because i would like to start learning scripting guns/animations soon too xD |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 21 Oct 2013 07:00 PM |
Nope, Can't figure out the angle stuff, or how to "move the head and get then look vector"
When life gives you lemons, Squirt 'em in your eyes. - Drahsid5 |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 21 Oct 2013 07:42 PM |
bump
When life gives you lemons, Squirt 'em in your eyes. - Drahsid5 |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 24 Oct 2013 05:45 PM |
bump
When life gives you lemons, Squirt 'em in your eyes. - Drahsid5 |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 24 Oct 2013 05:46 PM |
| Edit the joints in torso according to the camera |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 24 Oct 2013 05:50 PM |
how? I'm not really sure.
When life gives you lemons, Squirt 'em in your eyes. - Drahsid5 |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 24 Oct 2013 05:52 PM |
| Using CFrame Angles and unit vectors |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2013 05:55 PM |
| I spent months trying to figure this out. To tell you the truth, I don't even want to give the secret up. |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 24 Oct 2013 05:55 PM |
No dip. I'm not sure how I'd do that in the script, exactly.
When life gives you lemons, Squirt 'em in your eyes. - Drahsid5 |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2013 06:18 PM |
Hi, Could someone here give me the script for a gun with multiple brick parts be able to move to all angles? I already have the one that works with mesh guns. |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2013 06:25 PM |
| Use trigonometry to determine the angle. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 24 Oct 2013 06:27 PM |
| ^ you can use atan2 for what you want |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2013 06:36 PM |
| I don't know that trigionometry is and, most importantly, how to script... |
|
|
| Report Abuse |
|
|