示例#1
0
        /**
         *  @brief Initializes internal properties based on whether there is a {@link TSCollider} attached.
         **/
        public void Initialize()
        {
            if (initialized)
            {
                return;
            }

            tsCollider = GetComponent <TSCollider>();
            if (transform.parent != null)
            {
                tsParent = transform.parent.GetComponent <TSTransform>();
            }

            if (!_serialized)
            {
                UpdateEditMode();
            }

            if (tsCollider != null)
            {
                if (tsCollider.IsBodyInitialized)
                {
                    tsCollider.Body.TSPosition    = _position + scaledCenter;
                    tsCollider.Body.TSOrientation = TSMatrix.CreateFromQuaternion(_rotation);
                }
            }
            else
            {
                StateTracker.AddTracking(this);
            }

            initialized = true;
        }
示例#2
0
 /**
  *  @brief Moves game object based on provided translation vector and a relative {@link TSTransform}.
  *
  *  The game object will move based on TSTransform's forward vector.
  **/
 public void Translate(TSVector translation, TSTransform relativeTo)
 {
     this.position += TSVector.Transform(translation, TSMatrix.CreateFromQuaternion(relativeTo.rotation));
 }