New answers tagged

1

I've solved a problem with a simple logic. Now, When player dies, camera position will be set exact to the player position, thus focusing the camera on player. And after that the orthographic size of the camera will reduced to give it zooming effect. Here is code snippet : IEnumerator ZoomIn() { while (GameCamera.orthographicSize > 2) { yield ...


2

I could not find anything on this subject so I invented my own algorithm which works by iterating over and over again to find more precise results. The higher you set the iteration count, the more precise it will be. hope this helps anyone who has the same problem public Vector3 GetPointClosestTo(Vector3 p, out float result, out int curve) { // an ...


0

Take a look at Viewports. Many of the Viewport subclasses take virtual height and width in their constructors. There are different flavors of viewport depending on how well you want Libgdx to keep to your desired aspect ratio.


6

You can't. The two matrices are constructed in completely different ways. There are tons of ways to find more information on that by googling. You can't get the field of view from the orthographic camera because there is no such thing.


1

You can't. This is assuming that you have used the following function void gluLookAt(GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ, GLdouble centerX, GLdouble centerY, GLdouble centerZ, GLdouble upX, GLdouble upY, GLdouble upZ); to get your transformation matrix, and that you want to find what values were used for center parameters. The ...


0

Swing / Java2D doesn't have a concept of a camera, but what you can do is store the transform of the camera, and apply that first before any other transforms. Also note that you are almost certainly going to run into unpleasant performance problems if you're not using an OpenGL-based rendering system. (I speak from years of painful experience.) I would ...


2

Try this: Add a kinematic Rigidbody to the camera Cache the rigidbody Use rigidbody.position and rigidbody.rotation instead of transform.position and transform.rotation Call CameraMove() from FixedUpdate() instead of LateUpdate() Play around with interpolation on the camera and the player if necessary public Rigidbody player; Quaternion targetLook; ...


-1

I fixed it :D. I just multiplied Time.deltaTime to smoothLook.


1

To do this you'll want to use a routine that runs every frame, like Update, LateUpdate, or a coroutine, so you can adjust the camera's position repeatedly. You'll also want to store information about where you're supposed to be looking so you can keep turning towards it (particularly if you want to use this to follow a moving object) Here's one way to do ...


0

As I explained above, this is not an issue with quaternions. Quaternions just represent your rotation. The problem is that you have mutually conflicting goals for this rotation: The camera can look in any direction and always turn left/right/up/down about its own local axes The camera never rolls relative to the world up direction To see why these are ...


0

Lets start of by defining a few variables. Lets say that o is the position of the player, d is the point that we want the player to look at, c is the position of the camera and dist is how much do we want to move c towards d, were dist is a float between 0 and 1. float cX = (dX - oX) * dist + oX; float cY = (dY - oY) * dist + oY; In case you want to move ...



Top 50 recent answers are included