Tag Info

New answers tagged

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 ...


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.


0

You need to transform the world space rotation vector to model space before applying the rotation. Vectors are transformed with inverse transpose of the matrix, i.e. v'=transpose(inverse(M))*v Because models generally define model->world matrix you need to invert this to get world->model matrix. So you need to calculate v' = ...


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) || ...


0

If the player is looking directly at the camera we can use the following idea to find the direction the player should walk, based on the position of the camera. We have two vectors C: (camera.Transform.Forward) the direction the camera is looking at and P (player.Transform.Forward) the direction the player is looking at. By computing the acos of the dot ...


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 ...


-1

I shall rephrase, the direction the player is facing is the forward direction, Therefor the camera should face forward (i.e the direction the player is facing), so the camera should be aimed at the player location always (unless you choose it to follow a different object like a vehicle) so there fore the camera facing point is player.location (This isn't ...



Top 50 recent answers are included