Reverse acceleration not working

I’m trying to achieve a “boomerang”-ish objects.

I’m using fastcast for my boomerang projectiles but I cant seem to get it to work.

This image here (https://media.discordapp.net/attachments/1014149876818399253/1014149877300731965/unknown-17.png) is the thing I formed in a rush when I try make it go on reverse, but it doesnt work.

same with this

b.Acceleration = (pos1 - pos2).Unit * calc

none of them eventually work, they either accelerate forwards or not accelerate at all.
oCamRec (1) heres how it turns out.

why are you only using the Z component? the acceleration in CastBehavior is independent from the direction of the cast, so it’s only ever going to accelerate on the world Z axis.

1 Like

because i want it to move only in the z axis (so going back to the entity as is)

have you ever used the fastcast module

the direction of acceleration needs to be negative of the firing direction. the tower isn’t only firing in the Z axis is it?

its only firing in the z axis, i use lookvector and all that so that i could put it where it should move towards.

lookvector isn’t always on the Z axis. it’s the Z axis for the individual cframe but not the world axis.

1 Like

but how would I apply lookvector to this? I tried multiple times it just ends up accelerating it further or just does nothing

your thing is already correct, just change the acceleration so that it uses X Y and Z not just Z. remove the math.abs as well.

alright, ill try it out ill get back to you in like a few mina

apologize for the long wait, friend just got home.

b.Acceleration = (pos1 - pos2).Unit * calc * (3 * Tower:GetAttribute("Distance")/2)

rhis is what i used, still doesnt want to work sadly

is the direction of the cast pos2 - pos1?

yeah
(kakssisjejdhdjdjeiieidjajenneh sorry)

huh. as long as your acceleration is pos1 - pos2 and initial velocity is pos2 - pos1 then your acceleration is good. there’s a chance that either you’re multiplying one of them with a negative number, or the magnitude of your acceleration is too low/high. try setting the magnitude of the acceleration to be the same as the initial speed; it should come to rest after exactly 1 second.

1 Like

how would that look like? cant go off of that because im dumbfounded

mind sending the castbehavior/cast firing script you have right now?

sure!

	
	Senor = function(Tower, Target)
		local lvp = Target.Position.Position
		local cf = CFrame.lookAt(Tower.Position, Vector3.new(lvp.X, Tower.Position.Y, lvp.Z))
		
		local t = towers[Tower]
		local se = t.ProjectileSettings
		
		local offsets = {
			cf * CFrame.new(0.2,0.7,0);
		}
		
		local rp = se[3]
		local b = se[2]

		rp.FilterDescendantsInstances = {workspace}
		rp.FilterType = Enum.RaycastFilterType.Blacklist
		
		local pos1 = offsets[1].Position
		local pos2 = offsets[1].Position + offsets[1].LookVector * Tower:GetAttribute("Distance")
		local calc = (pos1 - pos2).Magnitude
		
		local acceleration = pos1 - pos2
		local velocity = pos2 - pos1
		
		b.Acceleration = acceleration
		b.RaycastParams = rp
		
		TC:FireAllClients("Anim", Tower, "Shoot")
		local cast = td:Fire(Tower, offsets[1].Position, offsets[1].LookVector * Tower:GetAttribute("Distance"), velocity, banana)
		
		task.delay(calc/2, function()
			if not cast then return end
			if not cast.Terminate then return end
			cast:Terminate()
		end)
	end,
	

there’s your issue, you’re not using the velocity. inside td:Fire() you want to replace offsets[1].Position with velocity, because the second argument is the direction it goes initially. I also believe you want to replace Tower with offsets[1] if that’s where it’s shooting from.

additionally in FastCast the third argument is a number not Vector3, so remove the LookVector *.

unless, now that I’m thinking about it, td is a different object and not a Caster lol. although I don’t see the CastBehavior being used at all.

:Fire’s 3rd parameter accepts a number or a Vector3 value.
offsets[1] is changed so that its now where tower is at

td:Fire() is a custom function that I use to fire without much preparation.