New answers tagged

0

Add map and objects to a container. Example: container.x = -camera.x (illusion camera moved through world) a = OBJECT location b = TARGET location t = decimal between 0 and 1 function lerp(a, b, t) return a + (b - a) * t end Return INTEGER to move from a to b. As a is closer to b, integer will become smaller (deceleration). camera.x = 100 target.x ...


1

Input.GetButton() instead of Input.GetButtonDown() The former checks to see if the key is currently down and outputs true for every frame during the press. The latter checks to see if the key was up last frame and down this frame (that is: true for exactly one frame until released again).


1

The first scenario is called Panning or sort of Parallex without having Camera Follow. It will totally up to you that how you handle behavior of Camera. That means pausing game, move camera ahead, you can do it manually like other objects. In second case I think you are asking about Smooth Camera Follow that would follow your character in smooth manner. ...


1

I think the first one you are describing most closely matches a Fixed 2D camera and the second is a smooth floating or smooth sidescrolling 2D camera


0

My hybrid solution works! The gimbal lock was still there because I had a rotation lag on the CameraSpringArm, which does not support 6 DoF. Removing the camera lag (CameraSpringArm->bEnableCameraRotationLag = false;) solved the problem.


1

Well, to achieve your requirement, I have another work around, place these lines of code in very same script. ... public float _cameraRotationSpeed = 0.1f; ... void Update () { ... ... if (Input.GetKey ("z")) { tiltCamera (true); // Replace parameter with bool } else if (Input.GetKey ("x")) { ...


0

You would have to render your scene into a cube map, then render a quad. The texture coordinates would then translate directly to longitude/latitude you can use to calculate the vector to use for sampling the cube map. For equirectangular projection: lon = u*2*pi lat = (v*2-1)*2*pi x = cos(lon)*cos(lat) y = sin(lon)*cos(lat) z = sin(lat) Where u/v are ...


0

XNA has a Vector3.Forward, transform that with your cameras viewmatrix and if necessary set your y component to zero and normalize. Generally if this gives you trouble you should refresh your basic understanding of linear algebra.


1

One way to do this would be to clamp (limit) the x and y values of the camera to your width and height of the game. It may look something like this: Clamp method: public int clamp(int var, int max, int min) { if(var > min) { if(var < max) { return var; } else return max; } else return min; /* * var = your variable ...


0

Both options are basically the same. In the end you do have a bunch of vertices that you multiply by mModel * mView * mProjection. If you move the camera within the world, that transformations go into mView. If you move the world around - into mModel. mModel is actually constructed of many matrices guiding how objects and sub-objects are positioned within ...


1

The answer is in your second sentence. Camera is child object of Character. The Camera should not be a child of the character. This is what is causing the camera to tilt. A child will follow its parent's transform. Remove the Camera from the Character. The script @Jon linked to will do what you want by modifying the camera transform, as the ...


0

This has been done before in a video tutorial for a "Horror Game". They label it 'True FPS'. Right now it sounds like the mouse movement is moving the camera and not the body. What you want to do is attach the Camera to a Socket on the Skeleton (if you want the camera to move with the animations as well). If not you can just position the camera where you ...


0

Mathf.Clamp is most certainly the way to go for creating boundaries, however, I would also suggest creating a boundary class and give them x, y, and z parameters. The best example I could give is my implementation of creating a boundary in a 3D environment for a side scroller game. using UnityEngine; using System.Collections; [System.Serializable] public ...



Top 50 recent answers are included