About Store Forum Documentation Contact
Donations:
140$/mo



Post Reply 
Destructible objects disappearing
Author Message
Harton Offline
Member

Post: #1
Destructible objects disappearing
I am writing a class extension for a class Game::Destructible.
If a player destroys an object, the object is slowly disappearing.
I change the material properties of the object, just want to change the alpha channel between 0 and 1 at the time. But when I change the value of the game throws an error "access to memory.
My code:
Code:
Bool G::Destruct::update()
{
    if(breaked)
    {
        m_alpha += 0.01;
        T.material->color = ColorAlpha(T.material->color,m_alpha).asVec4();

        // ...
    }

    return __super::update();
}
How can I change the alpha channel in the material?
12-27-2010 02:22 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Destructible objects disappearing
probably material is NULL

you need to use Mesh::drawBlend, instead of Mesh::draw, it has parameter for color/alpha multiplier
12-27-2010 05:11 PM
Find all posts by this user Quote this message in a reply
Post Reply