AlignOrientation not working properly

In my game, a player can use an ability that allows them to cast a flamethrower. When a player turns their camera quickly, the particle emitters will not match up with a rigid hitbox, so I’m trying to create one using constraints. I’m using AlignPosition and AlignOrientation. The AlignPosition works pretty well connection the joints of the hitboxes, but the AlignOrientation completely messes up for some reason, even with super high Responsiveness/MaxForce/MaxAngularVelocity

Here is a gif:

Here is the code:
local hb1Size =, 4, 10)
local hb2Size =, 8, 15)
local hb1CF = sHRP.CFrame *, 0, -hb1Size.Z/2)
local hb2CF = hb1CF *, 0, -hb2Size.Z/2)
local hb3CF = hb2CF *, 0, -hb2Size.Z/2)
--new box part is basically instance new part with automatic cancollide off, anchored true
local hb1 = NewBoxPart()
local hb2 = NewBoxPart()
local hb3 = NewBoxPart()

local ao1, ap1 ="AlignOrientation"),"AlignPosition")
local ao2, ap2 ="AlignOrientation"),"AlignPosition")
local ao3, ap3 ="AlignOrientation"),"AlignPosition")

ao1.Parent = hb1
ap1.Parent = hb1
ao2.Parent = hb2
ap2.Parent = hb2
ao3.Parent = hb3
ap3.Parent = hb3

local a1 = sHRP:FindFirstChild("RootRigAttachment")
local a2, a3 ="Attachment"),"Attachment")
local a4, a5 ="Attachment"),"Attachment")
local a6 ="Attachment")

a2.Parent = hb1
a3.Parent = hb1
a4.Parent = hb2
a5.Parent = hb2
a6.Parent = hb3

local bruh = 50000000
local bruh2 = 200
local mv =, 1, 1) * 50000000

ao1.MaxTorque = bruh
ao2.MaxTorque = bruh
ao3.MaxTorque = bruh

ao1.Responsiveness = bruh2
ao2.Responsiveness = bruh2
ao3.Responsiveness = bruh2

ao1.MaxAngularVelocity = mv * bruh
ao2.MaxAngularVelocity = mv * bruh
ao3.MaxAngularVelocity = mv * bruh

ap1.RigidityEnabled = true
ap2.RigidityEnabled = true
ap3.RigidityEnabled = true

hb1.Size = hb1Size
hb2.Size = hb2Size
hb3.Size = hb2Size

hb1.Massless = true
hb2.Massless = true
hb3.Massless = true

hb1.CFrame = hb1CF
hb2.CFrame = hb2CF
hb3.CFrame = hb3CF

--this is a folder in workspace
hb1.Parent = Effects
hb2.Parent = Effects
hb3.Parent = Effects

a2.Position =, 0, hb1Size.Z/2)
a3.Position =, 0, -hb1Size.Z/2)
a4.Position =, 0, hb2Size.Z/2)
a5.Position =, 0, -hb2Size.Z/2)
a6.Position =, 0, hb2Size.Z/2)

ap1.Attachment0 = a2
ao1.Attachment0 = a2
ap1.Attachment1 = a1
ao1.Attachment1 = a1

ap2.Attachment0 = a4
ao2.Attachment0 = a4
ap2.Attachment1 = a3
ao2.Attachment1 = a3

ap3.Attachment0 = a6
ao3.Attachment0 = a6
ap3.Attachment1 = a5
ao3.Attachment1 = a5

hb1.Anchored = false
hb2.Anchored = false
hb3.Anchored = false

To help visualize the intended effect

(Bird’s eye view)

Any help is appreciated, thanks.


Had a look at the video and have a question.
Is the problem that the red boxes are not staying aligned with the floor or that they are not staying aligned with each other?

Look at the boxes, and where the particles are.

The particle emitters are in the correct place and it’s the hitboxes that aren’t moving, correct?

Ok, so viewing the in frame by frame I see at one point the particle emitter and red hit boxes appear to be aligned to each other. After that they don’t.
Can you check the code, or let me see it?
I am asking to confirm there is nothing outside of the repeat that has been changed within the ‘fire’ function (or whatever you are using) that has not been reset back to its original value before executing the function again.

This isn’t my code or problem. I have as much info as you to try and figure this out.

Ooops. Sorry about that. Too eager to help. Should have read your post with more focus.

1 Like

The problem is that the hitboxes are not aligning with the particleemitters, yes.

They should be returning to their original positions (in the direction of the emitters) when the player stops rotating their character. The effect should emulate the drag that particle emitters show. I put some pictures back in OP, hopefully that helps visualize it better

The code I posted is the only thing that influences the hitboxes



Silly me forgot HingeConstraints exist. Got it working nice and smooth