Exemplo n.º 1
0
int CLuaMatrixDefs::SetRotation ( lua_State* luaVM )
{
    CLuaMatrix* pMatrix = NULL;
    CVector vecRotation;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pMatrix );
    argStream.ReadVector3D ( vecRotation );

    if ( !argStream.HasErrors () )
    {
        ConvertRadiansToDegreesNoWrap ( vecRotation );
        pMatrix->SetRotation ( vecRotation );

        lua_pushboolean ( luaVM, true );
        return 1;
    }
    else
    {
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );
    }

    lua_pushboolean ( luaVM, false );
    return 1;    
}
Exemplo n.º 2
0
void CVehicle::SetMatrix( const CMatrix& matrix )
{
    // Set position and rotation from matrix
    SetPosition( matrix.vPos );
    CVector vecRotation = matrix.GetRotation();
    ConvertRadiansToDegreesNoWrap( vecRotation );
    SetRotationDegrees( vecRotation );
}