If you've added all the walls and object to a parent node, you can just rotate that node. Technically the SKScene is the root node but I wouldn't advise rotating that, if possible at all.
Post
Replies
Boosts
Views
Activity
Hey @AnjaliNirmale, you can take the rotation of the longest surface and rotate the entire floor plan the same amount in the opposite direction. This way the longest line will be straight and your floor plan will appear to be straight.
Hey @Brent185,
Glad it cleared things up!
The scalingFactor is just an arbitrary number to make sure the size of the surfaces and objects is big enough to see in the SKScene. The actual number inside dimensions and transform is in meters, so to convert to 'actual dimensions' you have to do nothing! :D
I apply a scalingFactor, otherwise a wall of 5 meters would be 5 points long and in most SpriteKit scenes, this is so small, you would barely see it.
Definitely! See my project: https://github.com/denniswave/RoomPlan-2D
I've created a sample project: https://github.com/denniswave/RoomPlan-2D
I'm currently writing a full length article about this which is about half way done. I hope this clears everything up as I find it quite difficult to explain with little words :p. It'll most likely take a couple more weeks to be published though, sorry for the wait.
To summarise: The transform contains all the information about the position and rotation of the wall. The dimensions only holds the length of the wall. I don't calculate the two points of the wall, but rather create a line that is the correct length and place that line in correct position at the right rotation. Hope this helps ;)
Hey Brent,
Don't be sorry ;)
Basically, the dimensions give me the span (that is indeed the length) of the wall. This doesn't tell me anything about the position or rotation of the wall, just it's length or x value. I believe the direction you're after is the zRotation of my wallNode. It is calculated from the eulerAngles out of the transformation matrix.
Hey I've posted a follow up answer. Hope this clears thinks up. If not, I'm planning on writing something better and more elaborate but I'll have to do a lot more refactoring in order to have something to post since my code is quite split up into different functionalities.