I made a projectile, the intention is that it moves straight from the caster’s humanoid root part at the time of casting.
Well it does the job, however when the part is set free (unanchored) it chooses to move to the left (it also sometimes moves to the right), I assume this is not an issue with the code but with the body velocity. I attached screenshots of the “curve” and as you can see, the projectile when unanchored, is no longer centered. (the body velocity settings are MaxForce 5000,5000,5000, and P 1250)
I have reviewed the code (code below) and I have reviewed the attachments to the projectile, I cannot detect an issue
fireballClone.BodyVelocity.Velocity = (plr.Character.HumanoidRootPart.CFrame.LookVector*100)
local destination1 = Vector3.new(hit.Parent.Torso.Position.X, hit.Parent.Torso.Position.Y , hit.Parent.Torso.Position.Z)
local destination2 = Vector3.new(hit.Parent.Torso.Position.X, hit.Parent.Torso.Position.Y , hit.Parent.Torso.Position.Z)
local Settings1 = {Position = destination1}
local Settings2 = {Position = destination2}
Turning CanCollide off and making the part have an anti-gravity force could fix your problem
(You don’t want gravity, right?)
On a side, note, you may want to use LinearVelocity instead. BodyVelocity is deprecated and could be removed at any time.
That’s good, did you check the other thing I mentioned (CanCollide being off?)
This may be why your projectile is stuttering (colliding with the ground).
(As an alternative you could make the projectile spawn a slight bit above the ground so it doesn’t go inside it, in case you need CanCollide)=
It might be MaxForce = math.huge. I’ve seen 1e9 for max force works, maybe that could (somehow) fix your problem? (Also you may not want it to be massless. If this is an issue, as in it’s not going as fast as you want multiply your current calculation for vectorvelocity by attachment.Parent)
below is the dragon’s code, it does not affect the stutter, i have tried deleting it (the dragon starts as anchored and once it’s in position it become unanchored, a projectile going straight forward
local rise = true
local part = script.Parent
local count = 0
while rise do
wait()
part.Position = script.Parent.Position + Vector3.new(0,0.25,0)
count+= 1
if count == 20 then
rise = false
end
end
if rise == false then
part.Anchored = false
end
Try to set LV’s parent after all the values have been set (not using the second parameter), and setting its parent to fireballClone.
This both helps optimization for client-server communication and, I don’t think that LinearVelocity is meant to be put in an attachment.
Also, maybe try setting Attachment’s position to fireballClone.AssemblyCenterOfMass
Yes, LinearVelocity does need an attachment.
However, LinearVelocity does not need its parent to be the attachment, only the Attachment0 (and Attachment1 for some constraints, but don’t worry about that for LinearVelocity) property.