|
im making a gun and i need bullet travel my only problem is raycasting is unrealistic and is instant how can i fix this |
|
helloburpJoin Date: 2011-08-26 Post Count: 14376 |
just take a normalized velocity based on a bullet speed and the gun barrel's lookvector and either add it to the bullet every so often or set it as the velocity in a bodyvelocity |
|
|
but then that creates a problem which is taking damage as i herd that changing the position and using .touched dosent always fire |
|
helloburpJoin Date: 2011-08-26 Post Count: 14376 |
yeah then use bodyvelocity |
|
|
ok thx is bodyvelocity accurate on touched? |
|
TaaRtJoin Date: 2009-04-26 Post Count: 5070 |
if you do use raycasting however you can simply apply a randomized inaccuracy; if you know the 'ideal' travel trajectory of a bullet you can model a less ideal one from it. |
|
|
Many gun games use raycasting, and they use body velocity and other stuff to make it look realistic, if you play for instance phantom forces. You can see all those bullets, and fire effects etc.
They use either billboard gui, screengui or parts as for visual bullets |
|
helloburpJoin Date: 2011-08-26 Post Count: 14376 |
it is because the part it is attached to wont be anchored |
|
|
i rlly want to use raycasting cuz of its simplicity and accuracy but cant make it realistic |
|
helloburpJoin Date: 2011-08-26 Post Count: 14376 |
you can't make a raycast not instant, that just doesnt make sense
you could delay it i guess but that will just cause more frustration than anything else |
|
|
As I said, raycasting won’t be realistic, the effects is something you need to do on your own |
|
|
ig ill just use bodyvelocity but thanks for ur help anyways :) |
|
|
i think i found something, what if i just multiply how far the ray went after sometime ? |
|
annabet_hJoin Date: 2016-03-13 Post Count: 1475 |
what i'd do is make two points when i shoot, one at the end of the nozzle and one a few studs in front of it going towards the target
i'd then make a ray that goes through these two points. this acts as the bullet impact detector. if anything obstructs the ray, it hit something.
if it hit something, point B is changed to the hit position
i'd then make a neon part which goes from point A to point B, to visualize
i'd remove the part then start the process again, with point A being the previous point B |
|