New answers tagged

0

When making games, I typically support resolutions between 5:4 to 16:9. The best way I found to ensure maximum object coverage on the screen is to optimize for 3:2 and then adjust the camera's view along the axis that minimizes the amount of extra space. So if the game is in landscape mode and is being played on a 5:4 device, the width would remain static ...


0

To move Camera in TiledMap bounds, OrthogonalTiledMapRenderer was used. I have also noticed it behaves unexpectedly: while Camera reaches map bounds, tiled map, like by inertia, moves some pixels too far (it depends on the velocity of the swipe). As a solution, on each Camera movement, Camera is forcibly put in map bounds. See putInMapBounds() method. To ...


1

The difference between ScreenSize and WorldSize is part of the brilliance of graphics systems like OpenGL. ScreenSize is the actual size of the window in pixels. When the user grabs the window handles and resizes the window, then ScreenSize will change. WorldSize is the size of your game level or "World". It is completely arbitrary. In a 2D game, 1 unit in ...


0

I am not aware of an easy way of doing this. The way I'd do this is the following: Determine XY position of click on texture (x = 0..1, y = 0..1) How to do this depends on where you use it, but will likely require raycasting. Go to the camera that sends the image to the texture. Assuming the camera uses perspective projection: Calculate the 3D ...


2

This is a strange behaviour in Unity's scale inheritance system. If the parent has a non-uniform scale, when you rotate the child, they deform/stretch like a rubber band. Try adding an empty child GameObject to Player GameObject and parent the Camera GameObject to empty one, and put the rotation script on Camera. This makes parent of the Camera a ...


0

That jitter you see comes from the way floating point numbers work. A float has only a fixed number of significant digits. If they are storing a large number, the decimals suffer from loss of precision. Let me put an example using decimal numbers. Suppose floats can hold say, 5 significant digits only. Also, let's say the ship is positioned at 10.000, If ...


2

You can do this with two cameras with different culling masks. When you have multiple cameras in your scene, each camera will be rendered separately. The culling mask decides what will be rendered by the camera. Then the output of all the cameras get drawn on top of each other in order of their "Depth" value. Click on "Layers -> Edit Layers" and create a ...


-3

Try drawing the sprite before anything else.


1

So I guess you could save like the last 10 rotations in a List and get the average of them with this function. The function return could be set as your final rotation. This should smoothen your rotation. private Quaternion calcAvg(List<GameObject> rotationlist) { if (rotationlist.Count == 0) throw new ArgumentException(); float x, y, ...


0

As people said in comment, you need to provide more information. Here is a list of stuff you can check: Are Playercamera and Topcamera properly set in the editor Did you add your script to the objects you want to react to collision Did you add a collider component to these objects Did you check the "Is trigger" option (if yes, you should use OnTriggerEnter ...


0

Looks like that by luck I found the solution to the problem. I really don't like the glm documentation, was my understanding that glm doc was intentionally skinny since it matches corresponding glsl and glut. Anyway documentation is a mess. doc v 0.92 doesnt specify what unit to use, the gluPerspective uses degree, so that's why I used degrees. doc v0.94 ...


-1

Since the Unity bloom effects are post processed, they apply to the whole screen, so they can't be controlled by camera layers. Fixed it by not using it.


0

If your camera is always facing the same direction (let's say north) and just pans in the horizontal plane, use quads in a 3D plane to draw your scene. Since the camera is not rotating, you don't need to change the facing of your quads, just put them in the right spot in your 3D scene. Note the camera is orthogonal for the effect. If the camera is not fixed ...



Top 50 recent answers are included