generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: RayCasting

Previous Thread :: Next Thread 
spynaz is online. 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 is not online. 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 is online. spynaz
Joined: 17 Feb 2011
Total Posts: 1326
03 Dec 2012 08:47 PM
Can you give help now though?
Report Abuse
spynaz is online. spynaz
Joined: 17 Feb 2011
Total Posts: 1326
03 Dec 2012 11:30 PM
Bumpz.
Report Abuse
spynaz is online. spynaz
Joined: 17 Feb 2011
Total Posts: 1326
04 Dec 2012 11:38 AM
Bump.
Report Abuse
spynaz is online. spynaz
Joined: 17 Feb 2011
Total Posts: 1326
04 Dec 2012 12:28 PM
...
Report Abuse
NiceCake123 is not online. NiceCake123
Joined: 24 Dec 2011
Total Posts: 972
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 is online. 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 is not online. 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 is online. 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 is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
04 Dec 2012 02:29 PM
Yeye
Report Abuse
RoflBread is not online. 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
BJCarpenter is not online. BJCarpenter
Joined: 04 Nov 2008
Total Posts: 4416
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 is online. 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 is online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image