Tag Info

New answers tagged

0

The turn my comment up there to an answer : The "proper" way to use Lerp in your case would be that : Vector3 originalCameraPosition; bool hasBeenSet = false; public void OffsetCamera() { //Call that every Frame if(!hasBeenSet ) originalCameraPosition = cameraPosition; cameraPosition = Mathf.Lerp(originalCameraPosition , originalCameraPosition - ...


0

It seems like what you want is a camera target attached to the character as a child, which your camera will continuously move to look at. When your character ducks, you'll move the target a certain amount relative to the character, instead of the camera itself. Also, rather than lerping I would suggest using SmoothDamp to align the camera a fixed distance ...


0

Have you added player to the camera prefab? or camera to the player prefab? That is not the way to go in this case, especially if you want to have player and camera to have separate movement. I encourage you to separate camera from player then code the camera to follow the player. Something is wrong with what you are doing if you "cannot" move camera ...


4

This is entirely a matter of convention. (Since you didn't mention any particular tools.) But! If you are modeling in the same default orientation as your screen, which you say is right-handed, X-right, Y-up, and therefore Z-towards-you, then it would be natural to model your characters facing you, where forward is Z-positive. Which also implies your ...


0

The simplest option is actually inside of the Unity documentation itself, as I mentioned in my comment. Resources such as this one can easily be found by performing a search such as "Unity 5 Touch Detection," which will yield links to updated Unity 5 documentation regarding the touch system. An alternate way to find this information is inside of the Unity ...


2

First your use of the aspect ratio is nonsense. The aspect ratio is the relation of width to height. So if you have float aspectRatio = (float)myGameHeight / (float) myGameWidth; This means that the the following is true: myGameHeight == aspectRatio * myGameWidth If you want to preserve the aspect ratio of the screen you need to do the following: ...


1

FOV is field of view. Everyone likes to say that there is no camera in OpenGL, but to me that's a silly notion to hold on to even if it might be technically true. When you use the perspectiveCamera function you are essentially creating a camera. So think of the FOV as the type of lens. Is it a wide angle lens or more of a zoom lens? The FOV is given as ...


1

I would agree that it would be best to go fully 3D billboard with this. You can do this without shaders (well, you would use the built in BasicEffect which is an already written shader for you). Move the camera away from the scene and decrease the FOV. here's why: When you move the camera close to the scene and widen the FOV, the close fighter (blue ...


0

I figured out what the problem was. It was not a problem with the camera calculation, but rather with drawing the player. The player's coordinates is in pixels in the works ( between 0 and world.GetLength(0) * tile_width). So when I drew the player, I forgot to subtract the camera position so the player world stay inside the camera view. This is what my ...


0

Getting the lower boundary of the Camera in world space is easy with this little extension method: public static float LowerBound(this Camera parent) { return parent.transform.position.y - parent.orthographicSize; } I could give some more flexible methods, but this is simple and does exactly what you need.


3

You can do this in two ways, both of which require 3D cameras and projection: First, give all of your objects a 3D position in the world. // XYZ Vector3 Position; Next, create a camera with a position and orientation: class Camera { // Position of the camera in the world Vector3 Position; // Place where the camera is looking Vector3 ...



Top 50 recent answers are included