Example #1
0
void ChMatterSPH::ResizeNnodes(int newsize) {
    bool oldcoll = GetCollide();
    SetCollide(false);  // this will remove old particle coll.models from coll.engine, if previously added

    /*
    for (unsigned int j = 0; j < nodes.size(); j++)
    {
        //delete (nodes[j]);  ***not needed since using shared ptrs
        nodes[j] = 0;
    }
    */
    nodes.resize(newsize);

    for (unsigned int j = 0; j < nodes.size(); j++) {
        nodes[j] = std::make_shared<ChNodeSPH>();

        nodes[j]->SetContainer(this);

        nodes[j]->variables.SetUserData((void*)this);  // UserData unuseful in future cuda solver?
        //((ChModelBullet*)nodes[j]->collision_model)->SetContactable(nodes[j]);
        nodes[j]->collision_model->AddPoint(0.001);  //***TEST***
        nodes[j]->collision_model->BuildModel();
    }

    SetCollide(oldcoll);  // this will also add particle coll.models to coll.engine, if already in a ChSystem
}
Example #2
0
S_Chair::S_Chair( )
{
    AABox* aaBox = new AABox;
    aaBox->SetSize( 2.0f, 2.0f, 2.0f ); // CTODO: make better approximation
    aaBox->SetMass( 0.0f );
    SetCollide( aaBox );
}
Example #3
0
S_Chicken::S_Chicken( )
{
	AABox* aabox = new AABox;
	aabox->SetSize( CHICKEN_WIDTH_DEPTH, CHICKEN_HEIGHT, CHICKEN_WIDTH_DEPTH );
	SetCollide( aabox );

	Force* force = new Force;
	force->SetMaxVelocity( 3.0f );
	SetMoveForce( force );
}