ApplyAngularImpulse bullet is not arcing properly

I’ve been trying to create a mortar for the past couple days, and I have been stumped on the ApplyAngularImpulse function because I can’t seem to figure out how to arc the bullet using the impulse, and also rotate it to look at the target. Right now its just throwing itself at the target, and arcing at a fixed point not facing the target. Am I just not using the AngularImpulse function wrong or is there something else I can do?

Heres a somewhat clear video of my problem. It might be hard to see


You can see its launching itself toward the target, but its not arcing towards it, and instead its arcing towards its fixed position.

Heres my math and the ApplyAngularImpulse:

local direction = position2 - position1
	
	local duration = math.log((5+direction.Magnitude * 0.01))
	
	position2 = workspace.Enemy.Position + workspace.Enemy.AssemblyLinearVelocity * duration

	
	local clone = game.ServerStorage.TurretBulletProp:Clone()	
	
	xdistance = math.abs(barrelpos[1]-enemypos[1])
	zdistance = math.abs(barrelpos[2]-enemypos[2])

	angle = 90-(math.deg(math.atan(xdistance/zdistance)))

clone:ApplyAngularImpulse(Vector3.new((game.Workspace.Gravity * duration * 0.5) - 375, 0, 0))

Thank you for your time

3 Likes

I found out that making the bullet look at the target was able to fix it.
I was able to achieve this by just doing clone.CFrame = CFrame.new(position1, position2)
Im an idiot

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.