Unity控制把執行
視訊:https://www.bilibili.com/video/BV1oa4y1L7Qe
連結:https://pan.baidu.com/s/1ahrxle5I72FvywC1iv2_MQ
提取碼:ekbn
複製這段內容後開啟百度網盤手機App,操作更方便哦–來自百度網盤超級會員V3的分享
using UnityEngine;
namespace RTEditor
{
/// <summary>
/// This class can be used to store a snapshot of an object's transform data.
/// </summary>
public class ObjectTransformSnapshot
{
#region Private Variables
/// <summary>
/// This is the game object to which the snapshot data applies.
/// </summary>
private GameObject _gameObject;
/// <summary>
/// This is the snapshot of the object's absolute position.
/// </summary>
private Vector3 _absolutePosition;
/// <summary>
/// This is the snapshot of the object's absolute rotation.
/// </summary>
private Quaternion _absoluteRotation;
/// <summary>
/// This is the snapshot of the object's absolute scale.
/// </summary>
private Vector3 _absoluteScale;
#endregion
#region Public Methods
/// <summary>
/// Takes a snapshot of the specified object's transform data.
/// </summary>
public void TakeSnapshot(GameObject gameObject)
{
// Store the game object reference
_gameObject = gameObject;
// Take the snapshot
Transform objectTransform = gameObject.transform;
_absolutePosition = objectTransform.position;
_absoluteRotation = objectTransform.rotation;
_absoluteScale = objectTransform.lossyScale;
}
/// <summary>
/// Applies the snapshot data to the last game object whose snapshot was taken. This
/// method has no effect if no snapshot was taken before calling this method.
/// </summary>
public void ApplySnapshot()
{
// Is there any snapshot data available?
if(_gameObject != null)
{
// Apply the snapshot to the game object's transform
Transform objectTransform = _gameObject.transform;
objectTransform.position = _absolutePosition;
objectTransform.rotation = _absoluteRotation;
_gameObject.SetAbsoluteScale(_absoluteScale);
}
}
#endregion
}
}
相關文章
- Unity 多執行緒Unity執行緒
- unity多執行緒2Unity執行緒
- Unity3D執行報DllNotFoundExceptionUnity3DException
- 執行緒控制之休眠執行緒執行緒
- 多執行緒-執行緒控制之休眠執行緒執行緒
- 多執行緒-執行緒控制之加入執行緒執行緒
- 多執行緒-執行緒控制之禮讓執行緒執行緒
- 多執行緒-執行緒控制之中斷執行緒執行緒
- GCD執行緒控制GC執行緒
- 多執行緒-執行緒控制之守護執行緒執行緒
- Docker執行資源控制Docker
- Java多執行緒學習(2)執行緒控制Java執行緒
- 【java學習】控制執行流程Java
- 【Java基礎】:執行緒控制Java執行緒
- Qt---多執行緒控制QT執行緒
- 作業控制(後臺執行)
- 關於多執行緒控制執行緒
- unity小恐龍模型控制Unity模型
- 把 React 作為 UI 執行時來使用ReactUI
- 把可執行jar打包成exe檔案JAR
- JUC執行緒高階---執行緒控制通訊Condition執行緒
- java-執行 java 控制檯程式Java
- 命令執行順序控制與管道
- Linux學習--執行緒控制Linux執行緒
- 執行Java,不顯示控制檯Java
- Nginx執行控制虛擬主機和訪問控制Nginx
- idea建立、執行、打包控制檯程式Idea
- 第四章 控制執行流程
- 控制執行計劃之-SQL Profile(一)SQL
- C#控制只能程式執行一個C#
- 專案執行中的成本控制(轉)
- Java—執行緒的生命週期及執行緒控制方法詳解Java執行緒
- ubuntu 把檔案設定為可執行檔案Ubuntu
- 如何把 Java Web 應用放在 docker 容器中執行JavaWebDocker
- 把 java project 釋出成為可執行檔案JavaProject
- 20170526-27關於GCD控制執行緒併發數,多執行緒併發數控制GC執行緒
- Docker容器中執行.net framework控制檯程式DockerFramework
- golang 限流器,控制併發,執行緒池Golang執行緒