hey every one... i'm using raycast to shoot with my sniper, but it goes in a direct line... i want to make the gravity effect, but i don't know how to do it... if i could make a curved ray would be perfect, but i don't know how to do it. Some one can help me with this?
Thanks guys :)
Answer by Eric5h5
Apr 10, 2011 at 07:28 PM
Do a series of short raycasts, and alter the angle slightly for each one so that it starts heading down over a longer distance. So basically it's approximately a curve, broken up into a number of straight segments.
ok i think on that, but i was not sure with the performance... i will try that. Btw, it will take much process? Thanks
It's naturally more expensive than using a single raycast, but since this is for a sniper rifle, you'd presumably only be doing it occasionally, and not hundreds of times per second, so it wouldn't be an issue.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users post good questions and use the site effectively we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
No one has followed this question yet.
RayCast Problem : 2d
Raycast shooting problems
Shoot with ray cast angle
Need a script for a gun that shoots bullet using raycast