ElBurrito
|
  |
| Joined: 19 Sep 2009 |
| Total Posts: 24 |
|
|
| 20 Jan 2017 10:10 PM |
So I'm working on new morph positions for one of my games, what I'm doing is using a gui that when clicked changes the position of bricks within a player's morph. For the most part everything is working fine, except one specific part doesn't want to rotate correctly. Changing the rotation values of x or z cause the one part to move along the exact same axis, instead of the x and z axis separately.
Here's the basic script for what I'm doing to change the part's position.
function onClicked()
weld1 = script.Parent.Parent.Parent.Parent.Parent.Parent.Character.Model.Part1.Weld weld2 = script.Parent.Parent.Parent.Parent.Parent.Parent.Character.Model.Part2.Weld
weld1.C1 = CFrame.new(0,-.01,.04) * CFrame.Angles(1.029,0,0) weld2.C1 = CFrame.new(-.025,0,.025) * CFrame.Angles(1.9,3.15,0)
end script.Parent.MouseButton1Down:connect(onClicked)
Everything works fine for rotating part 1, however the x and z values of part two cause it to rotate on the exact same axis in the exact same direction. I've been reading the wiki and browsing the forums for anything that might help but I have yet to figure out why this is happening or if there is a solution to this that doesn't involve using a whole different method. Anybody have a clue as to why both these two values cause the brick to rotate in the same direction? |
|
|
| Report Abuse |
|
|
| 20 Jan 2017 10:29 PM |
| I believe the problem you're experiencing is called "gimbal lock". |
|
|
| Report Abuse |
|
ElBurrito
|
  |
| Joined: 19 Sep 2009 |
| Total Posts: 24 |
|
|
| 20 Jan 2017 11:04 PM |
Never heard that term before so I looked it up and yes, I am definitely experiencing a gimbal lock. So I would assume that the initial rotation of the brick before cframing may be the cause of the lock?
One thing I did before looking at your reply was to try changing the part into a union, which that did seem to fix the problem. Which from my experience the rotation of angled parts often changes when unioned. So I would guess the best way to go about "fixing" this problem is to either alter to parts position before cframing or just keep changing all three rotation values until the lock is undone? Unless anybody has a better solution. |
|
|
| Report Abuse |
|