I’ve been making an archery minigame and have been using linear velocity to send of the arrow in the direction the player is facing. However, the arrow wobbles once it is unanchored as it reaches its destination. I was wondering if there was a way to send it straight the way it should go.
local vA = Instance.new("Attachment", newArrow.Cylinder)
local LV = Instance.new("LinearVelocity", vA)
LV.MaxForce = math.huge
LV.Attachment0 = vA
LV.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector
LV.VectorVelocity = newArrow.Cylinder.CFrame.ZVector * -20
-- Assume you have an arrow part called "newArrow" and want to propel it in a specific direction
local newArrow = -- Reference to your arrow part
-- Calculate the desired velocity vector (adjust as needed)
local arrowSpeed = 20
local arrowDirection = newArrow.CFrame.ZVector -- Set the direction you want the arrow to go
local arrowVelocity = arrowDirection * arrowSpeed
-- Create a LinearVelocity instance to apply the velocity
local linearVelocity = Instance.new("LinearVelocity", newArrow)
linearVelocity.Velocity = arrowVelocity
-- You can also adjust other properties like MaxForce if needed
linearVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
Remember to adjust the values according to your game’s scale and requirements. Let me know if you have any further questions!
This seems to not work as well. The arrow spazzes out and glitches to the floor. I’m wondering if I need to adjust the constraint mode or if the weld constraint attached to both parts of the arrow is causing some issues.