Tag Info

Hot answers tagged

4

Create an empty gameobject, make it child of your gameobject. Move it to one of the corners you want to rotate about, Use RotateAround to rotate your gameobject. You could also do the same through code by calculating the dimensions of your gameobject. Edit: You could use these scripts to make your life easier: PivotManager, SetPivot.


3

First of all: most computer trigonometric functions takes radians as input. Even if the code worked, I am 99% sure it will not rotate by 90 degrees. So if it is that case, try changing it to pi/2. Secondly, if you would rotate by not-multiply of 90 degrees - the code would still produce axis-aligned rectangle (bounding box), NOT rotated rectangle as you ...


3

Not sure if this is the most performant, but it can be visualized easily: //assuming you're starting with a relatively orthonormal matrix 1.) Take one of your matrix's 3 basis vectors and dot it against the 6 world orthogonal vectors and set it to the one whose result is closest to 1.0. 2.) Do the same for one of the 2 remaining basis vectors. 3.) Cross ...


1

//temp helper variable var moveAmount = Point.Zero; if (InputHandler.KeyPressed(Keys.A) || InputHandler.KeyPressed(Keys.Left)) moveAmount.X -= 1; if (InputHandler.KeyPressed(Keys.D) || InputHandler.KeyPressed(Keys.Right)) moveAmount.X += 1; if (InputHandler.KeyPressed(Keys.W) || ...



Only top voted, non community-wiki answers of a minimum length are eligible