Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1. using UnityEngine;
  2. namespace Pathfinding {
  3.     using Pathfinding.Util;
  4.  
  5.     /** Helper for #Pathfinding.Examples.LocalSpaceRichAI */
  6.     public class LocalSpaceGraph : VersionedMonoBehaviour {
  7.         Matrix4x4 originalMatrix;
  8.         public GraphTransform transformation { get; private set; }
  9.  
  10.         void Start () {
  11.             originalMatrix = transform.worldToLocalMatrix;
  12.             transform.hasChanged = true;
  13.             Refresh();
  14.         }
  15.  
  16.         public void Refresh () {
  17.             // Avoid updating the GraphTransform if the object has not moved
  18.             if (transform.hasChanged) {
  19.                 transformation = new GraphTransform(transform.localToWorldMatrix * originalMatrix);
  20.                 transform.hasChanged = false;
  21.             }
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement