I’m trying to make a projectile that does this:
https://i.gyazo.com/a69c9b1286ff51d687e4f2a292902293.mp4
When you aim, the projectile ends up under your cursor, so you have to aim higher to reach your target. That’s what I want. I read Modeling a projectile’s motion - DevForum | Roblox but, EogMoose’s projectile will always travel and land exactly on your mouse.Hit.Position and it will give whatever velocity it needs to reach it in the given time. And when targeting the sky, the projectile basically disappears because of where mouse.Hit.Position is and how fast the velocity is.
In the GIF above, it doesn’t disappear when targeting the sky, and it looks like it travels at a constant speed. If you want a feel of the projectile, you can play it here Marvel: Enhanced - Roblox and test the projectile by pressing R
I messaged the owner of the game and she used BodyVelocity and for the velocity she did:
CFrame.new(StartPosition,MousePosition).LookVector * (Velocity number)
Me being new to this kind of math, did this:
My Code
tool.Activated:Connect(function()
if not DB then
local comet = CometVFX:Clone()
comet.CFrame = hrp.CFrame
comet.Parent = game.Workspace
local BV = Instance.new('BodyVelocity')
BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
BV.Velocity = (CFrame.new(hrp.Position,mouse.Hit.Position).LookVector * 75)
BV.Parent = comet
spawn(function()
DB = false
wait(5)
comet:Destroy()
end)
while wait() do
BV.Velocity = BV.Velocity - Vector3.new(0,2,0) --[makes it curve]
end
end
end)
This code kind of worked, since I had to aim higher to reach the target, but it fell much faster, so when I aimed at the sky, it barely even went up. It looked like this: https://i.gyazo.com/a0eed0bbbde26d424402f11691dd1be5.mp4
I can tell that what I did was very wrong lmao. So, I need help to fix this code. Thanks in advance!