In my game, multiple swords are going to be available. I’ve set up a system (using the first sword added) that welds the sword to the players right hand and orients it correctly, I would like all of the other sword models to also be oriented correctly in the players hand.
My problem is that upon adding the second sword to the game, even though the orientation of the model and all parts in the model match the first sword, it’s orientation is different in-game (its broadsided).
Screen shots below:
First Sword Added (correct orientation):
Second Sword Added (incorrect orientation, it is broadsided)
Models Properties:
First Sword Added (correct orientation):
Second Sword Added (incorrect orientation, it is broadsided)
Here’s the Chunk of Script that Orients the Sword:
Honestly an easier method to go about a changed orientation between multiple meshes, instead of re-exporting it to get it to align, you could mark an “Orientation” Attribute then have your weld depend on that offset orientation value.
Such that:
local position_offset = sword:GetAttribute("Offset") or Vector3.zero
local orientation_offset = sword:GetAttribute("Orientation") or Vector3.zero
local x, y, z = math.rad(orientation_offset.X), math.rad(orientation_offset.Y), math.rad(orientation_offset.Z)
weld.C1 = CFrame.new(position_offset) * CFrame.Angles(x, y, z)
This way allows you to have different attachment points for different sized items along with different/unique orientation methods without the need of re-exporting an already good model.