spynaz
|
  |
| Joined: 17 Feb 2011 |
| Total Posts: 1326 |
|
|
| 03 Dec 2012 08:22 PM |
| I made a bow script and I wan to make the arrow follow the raycasting path you create when you click. How would I do that? |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 03 Dec 2012 08:33 PM |
| When my wiki account has writer privileges I'm going to write tutorials on these types of things (and etc.) |
|
|
| Report Abuse |
|
|
spynaz
|
  |
| Joined: 17 Feb 2011 |
| Total Posts: 1326 |
|
|
| 03 Dec 2012 08:47 PM |
| Can you give help now though? |
|
|
| Report Abuse |
|
|
spynaz
|
  |
| Joined: 17 Feb 2011 |
| Total Posts: 1326 |
|
| |
|
spynaz
|
  |
| Joined: 17 Feb 2011 |
| Total Posts: 1326 |
|
| |
|
spynaz
|
  |
| Joined: 17 Feb 2011 |
| Total Posts: 1326 |
|
| |
|
|
| 04 Dec 2012 12:30 PM |
| Well get a animation tool out of free models to a animation and add that for ray casting or you use the script to move your arm the way u want when a certain key is pressed. |
|
|
| Report Abuse |
|
|
spynaz
|
  |
| Joined: 17 Feb 2011 |
| Total Posts: 1326 |
|
|
| 04 Dec 2012 12:33 PM |
| I'm trying to make the arrow correctly follow the raycasting path, not animate my arm. |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 04 Dec 2012 12:49 PM |
Essentially you would grab the end position of the ray and the position of the ray, minus the latter from the former, get the normalized vector of that, and apply velocity to the arrow in that direction. Optionally, you could add a BodyForce with 90*mass on the Y direction (I think that's right), to negate gravity, however being an arrow, gravity would make it more realistic.
So, put simply, make an arrow, and do this
arrow.Velocity = (RayPosition - player.Head.Position) * speed |
|
|
| Report Abuse |
|
|
spynaz
|
  |
| Joined: 17 Feb 2011 |
| Total Posts: 1326 |
|
|
| 04 Dec 2012 02:05 PM |
| By "RayPosition" you mean the ray's end point? |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
| |
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 04 Dec 2012 02:30 PM |
err sorry,
arrow.Velocity = (RayPosition - player.Head.Position).unit * speed |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2012 02:46 PM |
I don't think this is a Ray casting question. It's more of a logic question.
You could find a clear line-of-sight with a ray to a target, and use Find-PartonRay to find target position, but the arrow would travel in an Arc, and not follow or use the Ray, beside getting target Pos.
GL, Brian
|
|
|
| Report Abuse |
|
|
spynaz
|
  |
| Joined: 17 Feb 2011 |
| Total Posts: 1326 |
|
|
| 04 Dec 2012 04:42 PM |
| But I need raycasting so it doesn't go through anything if something is in the way. |
|
|
| Report Abuse |
|
|
spynaz
|
  |
| Joined: 17 Feb 2011 |
| Total Posts: 1326 |
|
|
| 05 Dec 2012 08:27 PM |
| Rofl, I did what you said but the arrow only flies if it is unachored and if it's unachored then it just goes up into the air and comes down, like a slingshot. :P |
|
|
| Report Abuse |
|
|