bleintant
(bleintant)
September 30, 2023, 2:17am
#1
Trying to make player’s HRP face the wall that they are positioned on. How can I fix my code so that it works as intended?
attachment0Orientation.Name = "Attachment0Orientation"
attachment0Orientation.Parent = hrp
attachment0Orientation.Position = Vector3.new(0,0,0)
local attachment1Orientation = Instance.new("Attachment")
attachment1Orientation.Name = "Attachment1Orientation"
attachment1Orientation.Parent = wall
attachment1Orientation.WorldPosition = raycastResult.Position
alignPosition.Attachment0 = attachment0
alignPosition.Attachment1 = attachment1
alignOrientation.Attachment0 = attachment0Orientation
alignOrientation.Attachment1 = attachment1Orientation
Make sure you set the LookAtPosition
property of AlignOrientation
.
bleintant
(bleintant)
September 30, 2023, 3:06am
#3
I’m confused as what I would set it to. I’ve tried setting it to my raycast intersection(raycast.Position), but the problem persists.
local alignOrientation = Instance.new('AlignOrientation')
alignOrientation.LookAtPosition = raycastResult.Position
alignOrientation.Parent = hrp
AlignOrientation.CFrame = CFrame.lookAt(HRP.Position, Wall.Position)
Make sure the AlignOrientation
has enough power to rotate your character as well,
Also set the AttachmentMode to OneAttachment as well
Existile
(Existile)
March 18, 2024, 10:50pm
#6
Bump.
I’ve been experiencing the same bug as was described in this thread that is now closed:
Reproduction Steps
Add an AlignOrientation with its attachment mode set to OneAttachment and update its CFrame or PrimaryAxis in a loop, you will see that nothing happens.
AlignOrientation using Attachment Mode OneAttachment does not update with .CFrame or .PrimaryAxis.
Expected Behavior
AlignOrientation should align its attachment0 to its .CFrame or .PrimaryAxis
Actual Behavior
The AlignOrientation appears to be facing default Vector3 value without updating the attachment0’s cframe/orient…
When messing about in playtest and using explorer, if I try modifying the align orientation properties, it seems to snap out of it and align correctly. But never via my script code, even if I try to enable/disable the instance.