Argument
variable is mouse
1 | local Arrow = Instance.new 'Part' |
2 | Arrow.Size = Vector 3. new(. 1 ,. 1 , 1 ) |
3 | Arrow.CanCollide = false |
4 | Arrow.BrickColor = BrickColor.new 'Brown' |
5 | Arrow.CFrame = Player.Character.HumanoidRootPart.CFrame+Argument.Origin.lookVector |
6 | local BodyForce = Instance.new 'BodyVelocity' |
7 | BodyForce.Velocity = Argument.Origin.lookVector* 50 -- this is probably what needs to be changed |
8 | BodyForce.Parent = Arrow |
9 | Arrow.Parent = workspace |
I think the problem is that the arrow is heading to the mouse position that is very far away. What I mean is that it ignores the parts that are closer to the mouse... Let me just give you an example:
---- = arrow trail
[] = part
o = Position the arrow is heading
How it is currently:
----------------[]-------------o
How I want it to be:
--------------o[]
In-game:
https://gyazo.com/a1ec1fe268fe72e0322f0e697e2c2bc2
I would appreciate any help, thanks.
@Nogalo
This works better but is this the right way of using raycasting? I'm new to it...
01 | local ray = Ray.new(Player.Character.RightLowerArm.CFrame.p,(Argument.Hit.p-Player.Character.RightLowerArm.CFrame.p).unit* 500 ) |
02 | local ignore = Player.Character |
03 | local hit,position,normal = workspace:FindPartOnRay(ray,ignore) |
04 |
05 | local Arrow = Instance.new 'Part' |
06 | Arrow.Size = Vector 3. new(. 1 ,. 1 , 1 ) |
07 | Arrow.CanCollide = false |
08 | Arrow.BrickColor = BrickColor.new 'Brown' Arrow.CFrame = Player.Character.HumanoidRootPart.CFrame+Argument.Origin.lookVector |
09 | local BodyForce = Instance.new 'BodyVelocity' |
10 | BodyForce.Velocity = (position-Arrow.Position)* 2 |
11 | BodyForce.Parent = Arrow |
12 | Arrow.Parent = workspace |