Hang this code under the camera
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Trace : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
float x = Input.GetAxis("Horizontal");//Rotate the camera
float y = Input.GetAxis("Vertical");
gameObject.transform.RotateAround(gameObject.transform.position, Vector3.up, x);
gameObject.transform.RotateAround(gameObject.transform.position, Vector3.right, y);
GameObject cube = GameObject.Find("Cube");//Require the object facing the camera
cube.transform.RotateAround(gameObject.transform.position, Vector3.up, x);
cube.transform.RotateAround(gameObject.transform.position, Vector3.right, y);
}
}
Two common methods to position DIV to the center of viewport 1. It is known that DIV is high, and it is calculated to position to the video center. 2.DIV wide high...
1. Create two cameras, one for the main camera, one is the target camera, hide after setting the position 2. Creating a script is mounted on the controller 3, Note: This script is only the function of...
A recent problem is how two objects in different directions can make his anchor point, that is, the X, Y, and Z axes always in parallel. After several days of reviewing the data, I found a way. as fol...
Unity Gizmos draws the camera's viewport, frustum and FOV First, the purpose Due to development needs, it is necessary to draw the camera's viewport, frustum, and FOV in order to observe some relation...
background When we compare mobile browsers to desktop browsers, the most obvious difference is the screen size. Websites designed for desktop browsers display significantly less content in mobile brow...
<%@page language=“java” contentType=“text/html; charset=UTF-8” pageEncoding=“UTF-8”%> <%@ include file="/webView/include/taglib.jsp"%> <%@ ...
Usage supported by the event center Simple send event: Send string type event: Send multiple parameter events: Monitoring event: Events for listening to parameters: Remove event: Remove all listening ...
First talk about Pivot and Center When the objectPivot andWhen the center coordinates are different, there will be some problems. For example: Center Pivot You can see that the coordinate axis is obvi...
As shown above, Colorbox (version: 1.3.19 + jQuery 1.7.2) fails to display in the center of the screen in the iPhone browser. After checking for a long time, it is found that the viewport is set on th...