void Update()
    {
        // Define zVector
        Vector3 zVector = DefineDirectionVector(_forwardVector.DefineVector3(), _forwardSpace, _spaceForwardRef, _forwardTarget);

        // Define yVector
        Vector3 yVector = DefineDirectionVector(_upwardVector.DefineVector3(), _upwardSpace, _spaceUpwardRef, _upwardTarget);

        // Apply rotation
        transform.rotation = Quaternion.LookRotation(zVector, yVector);
    }
Exemplo n.º 2
0
    void DefineRotationAxes()
    {
        // Define _zVector
        _zVector = DefineDirectionVector(_forwardVector.DefineVector3(), _forwardSpace, _forwardSpaceRef, _forwardTarget).normalized;

        // Define _yVector
        _yVector = DefineDirectionVector(_upwardVector.DefineVector3(), _upwardSpace, _upwardSpaceRef, _upwardTarget).normalized;

        // Define = _crossX _crossY and _crossZ

        _crossZ = Vector3.Cross(transform.forward, _zVector);

        _xVector = Vector3.Cross(_yVector, _zVector);
        _crossX  = Vector3.Cross(transform.right, _xVector);

        _perpendicularY = -Vector3.Cross(_xVector, _zVector);
        _crossY         = Vector3.Cross(transform.up, _perpendicularY);
    }
Exemplo n.º 3
0
 void DefineWorldPosition()
 {
     _worldPosition = DefinePositionVector(_position.DefineVector3(), _space, _spaceRef);
 }