I don’t understand why in like 1/100th of the time my dungeon have problem with the orientation my reasoning is I think it has to do with CFrame.Angle(0, math.rad(180), 0) mispreading the remaining angles and instead not keeping all of the 180 degree on the Y Axis does somebody already had this problem before if so how did you solve it ? Like sometimes it spreads (-90, 90, 0) like this sometimes it’s (90, 90, 0) etc.
Try not going all the way to 180; 179 should work fine. Steps of 90 also work well. There is a number conversion at the quarter marks when a number can flip from positive to negative, which can sometimes throw off the rotation calculation.
You’re saying 180, it’s taken it as -180 … it can’t misread 179 that way.
Splitting that into 3 steps of the full rotation will work also. ← I use this
The other way is to just add 1 degree to rotate it, checking if it’s where you want to change direction, then subtracting 1 degree until it’s back to the start.
Edit: AND there is CFrame.fromEulerAnglesXYZ() that I included in the post with the download.
Oh thanks I’ll try what if I try like 179.9 will it round ?
Ok now my dungeon piece are bending yayt
You can see when this will happen with a simple test: Go to the part you wish to move and manually type in 180. If that number changes to -180 you’re going to have this problem. It’s all about where it happens to be …
I am trying -180 and seems to work pretty fine now
Sweet, just keep this in mind when doing this and you will have no more problems.
Nope still have problems yayt oh man I thought -180 would solve it. Why is it spreading the 90 degree on some axis
I think the rotation problem of 90 degree that spreads has to do with the door being chosen on the dungeon dependant on the corridor I don’t know how to explain it
Can we see your script for this …
Humm not sure if I want other people to have the script of my dungeon I don’t want to create other competitors though can only give you the most important parts but not all the dungeon script. I worked hard on making the dungeon system so
Just the door script … would be fine.
Oh alright man I can give you that
local offset = (lastPieceDoor.CFrame * CFrame.Angles(0, math.rad(-181 + 1), 0)) * nextPieceDoor.CFrame:Inverse() * offsetCFrame
nextPiece:PivotTo(offset * nextPiece:GetPivot())
And this is being activated from a touch? (on the door)
First room generated
newPiece.Parent = game.Workspace.GameDungeon:FindFirstChild("Stage" .. NUMBER_STAGE)
newPiece:PivotTo(CFrame.new(startingPosition) * CFrame.Angles(0, math.rad(PossibleAngles[AngleIndex]), 0))```
Basically the system decide to choose the door from the previous room and snap the piece into this specific door
So A door could end up at any angle?
Exactly because the piece can be rotated at any angle from -180 to 90 for now seems like the little simple math addition seems to work well on replacing the piece to -180 degree which is then convert to 180 degree in positive I’ll keep testing to see if there isn’t some issues