Tag Info

Hot answers tagged

4

Rotations are extremely order-dependent. Doubly so when you're composing rotations in local space (so the axes you're rotating around are themselves rotating from one frame to the next) As an extreme example, imagine that you start facing z+, and in one frame you pitch (x rotation) 90 degrees up. In the next frame, you yaw (y rotation) 90 degrees left. ...


4

Normalization The best option would probably be to normalize the data. This can easily be done using the formula: x = a + (X - A) * (b - a) / (B - A) where a and b are the minimum and maximum values for your desired range, respectively; A and B are the minimum and maximum values for your original range, respectively; X is the input value (in your case, ...


3

I wrote a camera script that auto-zooms based on a transform's position and scale. Attach the script below to your Camera. Then, create a GameObject, and set its position and size. Then link this gameobject to the "Area" public property of this camera script. The "Area" GameObject can be adjusted at runtime, and should provide you with a mechanism to at ...


1

Well, a very basic linear interpolation pattern goes like this (pseudocode): currentVelocity = currentVelocity + (interpolationRate * (targetVelocity - currentVelocity )) Calling this on update instead of directly setting the current velocity will do what you requested, the transition speed is adjustable by adjusting the interpolationRate value (between ...


1

If you are creating a 2D game with tiles you can easily implement your own culling which is a lot cheaper since you only itterate over exactly what you need within your tile array. Things you should know: Camera location Viewport width/height Tile width/height Now we can calculate how many tiles should be drawn. Total horizontal tiles on screen = ...


1

Adding to what Erez said, you can make any game without using a Viewport and just scaling your textures to a fraction of the screen size, but most of the time using a Viewport is a better option because it scales everything for you. Although you can use any measurement for the game width and height, I like to choose a target resolution for my game ...


1

DMGregory posted this and I'm just copying his comment to be able to close this question with an answer. You're rotating with respect to Space.World. So if your camera's z-axis is pointing along the world x-axis, then what you're applying as a pitch (world x-axist rotation) will be observed as a roll (local z-axis rotation). Does the problem ...


1

The reason for you getting a black screen when you put the camera inside the cube is most likely back face culling. Try calling: glDisable(GL_CULL_FACE); In the beginning of your display function or in main (after enabling depth test) to disable back face culling. If that is helpful you can either change the winding order of your polygons or change ...



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