Hi! Can you guys help me with some tutorials or samples to start scripting my own Third person follow camera that orbit on X and Y of the mouse input.. i failed to do it with myself. Please help me!
There are standard ones that come with unity in the camera-controller package (I think its the camera controller package). On a side note, don't override default fonts in threads for no reason... especially with such a terrible one.
Well. I know about standard ones that come with unity but i looking for tutorials about making your own camera script from scratch. Thanks for note
3D Buzz Tutorial: http://www.3dbuzz.com/training/view/3rd-person-character-system If you want to make one yourself look up Polar Coordinates, and Polar Coordinate conversion to Rectangular/Cartesian Coordinates.
Try this. Code (csharp): public Transform target; float xAxis; float yAxis; const float distance = 10.0f; const float speed = 5.0f; void Update { xAxis += Input.GetAxis("Mouse X") * speed; yAxis -= Input.GetAxis("Mouse Y") * speed; Quaternion rotation = Quaternion.Euler(yAxis, xAxis, 0.0f); transform.rotation = rotation; transform.position = target.position + rotation * new Vector3(0.0f, 0.0f, -distance); }
^That doesn't work. This does: Code (csharp): public GameObject target; float radius = 3f, angleX = 0f, angleY = -45f; void Update() { radius -= Input.GetAxis("Mouse ScrollWheel") * Time.deltaTime * 100f; angleX += Input.GetAxis("Mouse X") * Time.deltaTime; angleY += Input.GetAxis("Mouse Y") * Time.deltaTime; float x = radius * Mathf.Cos(angleX) * Mathf.Sin(angleY); float z = radius * Mathf.Sin(angleX) * Mathf.Sin(angleY); float y = radius * Mathf.Cos(angleY); transform.position = new Vector3(x + target.transform.position.x, y + target.transform.position.y, z + target.transform.position.z); transform.LookAt(target.transform.position); }
Thank's alot grizzly WorldArchitect both scripts work , this is exactly what i was looking for! i'll modify it based on my need