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

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

            if (!_serialized)
            {
                UpdateEditMode();
            }

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

            initialized = true;
        }
Пример #2
0
 /**
  *  @brief Moves game object based on provided translation vector and a relative {@link FPTransform}.
  *
  *  The game object will move based on FPTransform's forward vector.
  **/
 public void Translate(FPVector translation, FPTransform relativeTo)
 {
     this.position += FPVector.Transform(translation, FPMatrix.CreateFromQuaternion(relativeTo.rotation));
 }