doneyes
|
  |
| Joined: 21 Mar 2008 |
| Total Posts: 3466 |
|
|
| 04 May 2013 09:28 PM |
How can I use this line:
ray = Ray.new(torso.CFrame.p+Vector3.new(x,y,z),(target.CFrame.p - torso.CFrame.p).unit * 500)
to shoot a projectile along it? |
|
|
| Report Abuse |
|
|
1Topcop
|
  |
| Joined: 09 Jun 2009 |
| Total Posts: 6635 |
|
|
| 04 May 2013 09:33 PM |
If the bullet is anchored, use CFrame, if it's not you can use BodyPosition.
Example with BodyPosition,
ray,endPos = -- Workspace:FindPartOnRay(--[[ stuff ]]) bullet.BodyPosition.position = endPos
Example with CFrame, startPos = bullet.Position distance = (endPos-startPos).magnitude for n=0,loop,.1 do bullet.CFrame = CFrame.new(startPos,endPos)*CFrame.new(0,0,n) wait()end -- At least, I think this is how I did it with CFrame. :P
This what you meant?
|
|
|
| Report Abuse |
|
|
pwnedu46
|
  |
| Joined: 23 May 2009 |
| Total Posts: 7534 |
|
|
| 04 May 2013 09:37 PM |
If it's just a projectile, you don't need a ray. Just make a part, apply a BodyVelocity in the direction that the gun is pointing, and add a BodyForce of
Vector3.new(0, bullet:GetMass()*195.5, 0) to offset gravity. |
|
|
| Report Abuse |
|
|
doneyes
|
  |
| Joined: 21 Mar 2008 |
| Total Posts: 3466 |
|
| |
|
|
| 04 May 2013 10:15 PM |
196.2 actually :P It's 20x earth's gravity; 9.81. |
|
|
| Report Abuse |
|
|