Emess
|
  |
| Joined: 01 Apr 2010 |
| Total Posts: 13331 |
|
|
| 29 Sep 2011 09:08 PM |
Let's say I have a gun. This awesome looking thing is a gun. __ ______|____ |_ __ ___|] |_| |_|
It's all a mesh. A single part gun. Let's raycast from the gun's position to the mouse's hit location. We then make the laser, but the ray starts at the middle of the gun. How would I use math to make the ray to start at the tip? I'm thinking about [ tool.Handle.Position + Vector3.new(0.5, 0, 0) ] but it doesn't work properly.
thx |
|
|
| Report Abuse |
|
|
| |
|
Tenal
|
  |
| Joined: 15 May 2011 |
| Total Posts: 18684 |
|
| |
|
xSIXx
|
  |
| Joined: 06 Aug 2010 |
| Total Posts: 9202 |
|
|
| 29 Sep 2011 09:12 PM |
| your really failing at the simple things in the ROD ripoff. |
|
|
| Report Abuse |
|
|
aboy5643a
|
  |
| Joined: 20 Nov 2010 |
| Total Posts: 2785 |
|
|
| 29 Sep 2011 09:14 PM |
You certainly wouldn't use X and Z maths to do this... Just use the lookVector of the gun and add half of the length of the gun. Ta-da.
"I like dooly-bops" -- ArceusInator |
|
|
| Report Abuse |
|
|
Tenal
|
  |
| Joined: 15 May 2011 |
| Total Posts: 18684 |
|
| |
|
Tenal
|
  |
| Joined: 15 May 2011 |
| Total Posts: 18684 |
|
| |
|
aboy5643a
|
  |
| Joined: 20 Nov 2010 |
| Total Posts: 2785 |
|
|
| 29 Sep 2011 09:36 PM |
*facedesk*
"I like dooly-bops" -- ArceusInator |
|
|
| Report Abuse |
|
|
Spectrumw
|
  |
| Joined: 04 Aug 2009 |
| Total Posts: 13510 |
|
|
| 29 Sep 2011 09:38 PM |
| workspace:FindPartInRay(Ray.new((gun.CFrame + gun.CFrame.lookVector * (gun.Size.z / 2)).p, Direction), Ignore Descendants) |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 29 Sep 2011 09:43 PM |
"tool.Handle.Size.y/2"
err
<'+1 Post. Ujelly?'> |
|
|
| Report Abuse |
|
|
Quenty
|
  |
| Joined: 03 Sep 2009 |
| Total Posts: 9316 |
|
|
| 29 Sep 2011 10:05 PM |
Here's my gun.
====+===== _______| |__________---|-___ |___ _____ __________----+ |_| |_|
It's bigger then yours. It makes a bigger bang. It also has a better sight. |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2011 10:08 PM |
gun.cframe + gun.cframe:pointtoobjectspace(0, 0, gun.size.z/2)
something like that |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2011 10:10 PM |
sorry i derped
gun.cframe + gun.cframe:pointtoobjectspace(gun.position + Vector3.new(0, 0, gun.size.z/2)) |
|
|
| Report Abuse |
|
|
OKevinO
|
  |
| Joined: 05 May 2010 |
| Total Posts: 1036 |
|
|
| 29 Sep 2011 10:44 PM |
um dude you should make a brick in front of the gun that is the bullet spawner
and start something with that, like
bullet = Instance.new("SpecialMesh") bullet.Parent = script.Parent.THEBULLETSPAWNERSNAME
and keep doing stuff like that, its probably wrong because im new to scripting
but thats all i can think of |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2011 10:55 PM |
| bullet.CFrame = gun.CFrame * CFrame.new(0,0,something) |
|
|
| Report Abuse |
|
|