Advertisement
IRCSS

Unity C# Dummy Transform

Dec 2nd, 2018
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. public class TransformDummy
  2. {
  3.     public Vector3 Position, LocalPosition, Scale, LocalScale;
  4.     public Quaternion Rotation, LocalRotation;
  5.  
  6.     public TransformDummy(Transform toSave)
  7.     {
  8.         this.Position = toSave.position;
  9.         this.LocalPosition = toSave.localPosition;
  10.         this.Scale = toSave.lossyScale;
  11.         this.LocalScale = toSave.localScale;
  12.         this.Rotation = toSave.rotation;
  13.         this.LocalRotation = toSave.localRotation;
  14.     }
  15.  
  16.     public bool SetTransform(ref Transform toSet)
  17.     {
  18.         if (!toSet) return false;
  19.         toSet.position= this.Position;
  20.         toSet.localScale= this.LocalScale;
  21.         toSet.rotation = this.Rotation;
  22.         return true;
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement