Raycast and bulletdrop?

Does anyone know a tutorial on how to use bulletdrop and raycasting for ranged weapons without the help of other modules like Fast Cast?

2 Likes

Bump.

Good luck, I’m also curious about this.

Your going to have to you a runservice and use it with raycast so that each frame it makes a ray using this;

MakePos = ProjectilePosition + (The Velocity you want) * DeltaTime -- from the run service I use heartbeat
ray = workspace:Raycast(ProjectilePosition, MakePos - ProjectilePosition)
ProjectilePosition = MakePos

Basically it will get the projectile’s position then add the velocity times the DeltaTime so that the position is now predicted with the velocity and the ray length depends on how much performance you have the higher perfomance the smaller the ray’s length since it will run faster. Then it will change the projectiles position to the new position so after it runs again it cycle. (The ray starts on the projectile’s position and the direction is the new position minus the projectile position so it will create the direction.
I will give credit to; @0Shank since they helped me a lot!

3 Likes

where can i find the post where he helped u. Edit :thanks alot for ur Help

I just messaged him but right here is where I first saw the showcase of it; Best way to Smooth Ballistic Physics? - #17 by 0Shank

Do u have a script for this? I really don’t understand it and i will promise that i will just use it for practice.

That is mainly the whole script with RunService;

local RunService = game:GetService("RunService")

local Projectile = {}
-- use the parts position such as an arrow make sure it is anchored since it works anchored
Projectile.Position = arrow.Position
Velocity = (direction - origin).Unit * 100 -- speed 
RunService.HeartBeat:Connect(function(DeltaTime)
--basically the code from before
MakePos = Projectile.Position + Velocity * DeltaTime -- from the run service I use heartbeat
ray = workspace:Raycast(Projectile.Position, MakePos - Projectile.Position)
Projectile.Position = MakePos
arrow.Position = Projectile.Position 
end)
3 Likes

I dont know what arrow.Position and makepos is.

MakePos is already a variable and arrow is just a part

What kind of part is arrow? I’m sorry if im not understanding this correctly as I’m new to scripting, but when did we ever declare arrow ?

That is what I called the part you can call it whatever you want but arrow is just a name of the part/projectile.

Could i just use a while Loop for this instead of heartbeat ?

You could but you would not get the delta time since the delta time is used for the ray’s length.

1 Like

Ok last question is that a Serverscript?

Yes but you could use it on a local but I prefer server.

Yes but how can the server know how many fps the client has?

it just gets the performance of the server. But you can use the script in a local to get the fps. So it does not know how much fps a client has.