About Store Forum Documentation Contact



Post Reply 
destruction objects
Author Message
b1s Offline
Member

Post: #1
destruction objects
How can i add force to each peace of the object?
Ive been trying to do this:


FREPA(actors)actors[i].addForce(Vec(10));


This gives force to only one part of the broken object.

im stunned. smile
06-04-2010 12:15 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #2
RE: destruction objects
maybe the object is already broken into pieces? (check the codes, when it's broken into pieces, there are many objects created, and each object being only 1 piece)
06-04-2010 08:25 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #3
RE: destruction objects
yes it is already in pieaces.. i was wondering how to give all the pieces force..
or are they not connected anyway anymore to the parent?
Okay.. i did something like this.. seems to work. don't really know how efficient is it..

if someone finds usefull:
Code:
void DestructObject::toPieces() // convert STATIC or BREAKABLE into many PIECE objects
{    
    
    bool force=true;
    if (force)
    {
        Memc<DestructObject*> objects;
        Game::World.objGet(objects,Ball(1.25f,Vec(pos()+matrix().y*0.8f+matrix().z*​0.8)),OBJ_DESTRUCTIBLE); // get objects in radius
        REPAO(objects)->actors.first().addForce(Vec(10));
        force=false;
    }
    __super::toPieces();
    destroyed = true;
}
(This post was last modified: 06-05-2010 01:30 PM by b1s.)
06-05-2010 01:24 PM
Find all posts by this user Quote this message in a reply
Post Reply