//-------------------------------------------------------------------------
bool PUPlaneColliderTranslator::translateChildProperty( PUScriptCompiler* compiler, PUAbstractNode *node )
{
    PUPropertyAbstractNode* prop = reinterpret_cast<PUPropertyAbstractNode*>(node);
    PUAffector* af = static_cast<PUAffector*>(prop->parent->context);
    PUPlaneCollider* affector = static_cast<PUPlaneCollider*>(af);

    if (prop->name == token[TOKEN_NORMAL])
    {
        // Property: normal
        if (passValidateProperty(compiler, prop, token[TOKEN_NORMAL], VAL_VECTOR3))
        {
            Vec3 val;
            if(getVector3(prop->values.begin(), prop->values.end(), &val))
            {
                affector->setNormal(val);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_PLANECOLL_NORMAL])
    {
        // Property: plane_collider_normal (deprecated and replaced by 'normal')
        if (passValidateProperty(compiler, prop, token[TOKEN_PLANECOLL_NORMAL], VAL_VECTOR3))
        {
            Vec3 val;
            if(getVector3(prop->values.begin(), prop->values.end(), &val))
            {
                affector->setNormal(val);
                return true;
            }
        }
    }
    else
    {
        // Parse the BaseCollider
        PUBaseColliderTranslator baseColliderTranslator;
        return baseColliderTranslator.translateChildProperty(compiler, node);
    }

    return false;
}
예제 #2
0
void PUPlaneCollider::copyAttributesTo( PUAffector* affector )
{
    PUBaseCollider::copyAttributesTo(affector);
    PUPlaneCollider* planeCollider = static_cast<PUPlaneCollider*>(affector);
    planeCollider->setNormal(_normal);
}