Hot answers tagged

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 ...


2

Your problem comes from setting the position of the camera in late update. Change your LateUpdate code to something like this and remove the code from Update void LateUpdate() { offset = Quaternion.AngleAxis(Input.GetAxis("Mouse X") * turnSpeed, Vector3.up) * offset; transform.position = player.position + offset; transform....


2

StarCraft uses a top-down camera. Generally camera types are named based on their projection method and constraints they place on viewing the world. A top-down camera is generally called such because it always sits above the action, looking down. The way you interact with the camera's constraints is usually less of a factor in what we call them. StarCraft'...


1

Everytime you move the sprite, move the camera too. This sounds like it's essentially what you're doing now. If you're encountering performance issues, then you should profile your code to determine where your slow code is. If you're not seeing performance issues, then you don't need to worry about performance issues. Doing a few calculations every frame to ...


1

scroll value resets when it's not scrolling. For one time scrolling the value turns +/- 0.1f. For multiple time scrolling at a time it changes +/- 0.1f on the current scroll value. Else it resets to Zero on next frame. That's why scrollCount will be used as scroll counter. Two new variables: private float scrollCount = 0f; //scroll count is related to max ...


1

give this script to player.this script find camera then give camera.position so you can use Lerp for following using UnityEngine; using System.Collections; public class CameraFollow : MonoBehaviour { void Update () { Vector3 offest = new Vector3 (3,3,3);//Distance from object Vector3 cameraPos = Camera.main.transform.position;//...


1

You want to use GameObject.FindWithTag which will return the first active GameObject in the scene that matches the tag you pass in as the parameter. So assuming your player GameObject uses the tag Player, you would do the following. void Start() { Transform player = GameObject.FindWithTag("Player").transform; }


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 ...


1

Try changing the camera's orthographic size based on aspect ratio. The larger the orthographic size the farther out it will have "zoomed". For instance, if your camera's orthographic size is 10 normally, when you switch to 16:9 aspect ratio set the orthographic size to a smaller value. Or for perspective camera you can try this



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