# Problems with Velocity and Vectors

I want to create a tool that allows you to throw a ball where the mouse is aiming, but I’m having some problems with the direction it takes. Somehow, it is Precisely inexact, because the behaviour isn’t random.

The code for generating the ball is:

HRPCF is the CFrame of HumanoidRootPArt
origin is the mouse origin CFrame
inst is the part saved in the tool

``````local bullet = inst:Clone()
local CD = script:FindFirstChild(inst.Name).Value
if CD == nil then
warn("No CD for bullet "..inst.Name)
return
end
bullet.CollisionGroupId = PS:GetCollisionGroupId("Bullet"..player.Name)
bullet.Anchored = false
bullet.Position = HRPCF.Position + HRPCF.LookVector * 3
bullet.Parent = game.Workspace.Bullets
bullet.Velocity = origin.Position + origin.LookVector * 300
bullet.Action.Disabled = false
``````

I recorded a video of how it is actually behaving

robloxapp-20201223-1704415.wmv (1.6 MB)

Shouldn’t you just use `origin.LookVector * 300` as the velocity instead of adding it to `origin.Position`?

It seems like you would only need the mouse CFrame to get the direction of the bullet.

1 Like

I think you’ll need to take the tool’s origin part and subtract to the mouse.Hit.p, and taking the Unit of the LineForce as the Velocity.

1 Like

isn’t mouse.Hit null if aiming sky?

Won’t that get the direction but bassed from position 0,0,0 ?

Nvm, checked and seems to work, the problem is that the force isnt enough to get exactly where my mouse is aiming, but direction is correct, now I got a problem cuz I dont want too much force neither little bit. thx u!

I think that would just be a matter of tweaking the constant that you multiply with the velocity.