Exemple #1
0
void le::Body::CreatePolygonShape( Vector2f SizeBody, Vector2f Center, float Angle )
{
	if ( body != NULL )
	{
		PolygonShape* Shape = new PolygonShape( SizeBody, Center, Angle );
		Shape->SetPropirtes( fDensity, fRestitution, fFriction );
		Shape->SetFixture( body->CreateFixture( &Shape->GetFixtureDef() ) );
		body->GetFixtureList()->SetFilterData( *Filter );
		vShape.push_back( Shape );
	}
}
Exemple #2
0
void le::Body::SetSize( Vector2f SizeBody )
{
	for ( int i = 0; i < vShape.size(); i++ )
	{
		PolygonShape* Shape = vShape[ i ];
		body->DestroyFixture( &Shape->GetFixture() );
		Shape->SetSize( SizeBody );
		Shape->SetFixture( body->CreateFixture( &Shape->GetFixtureDef() ) );
	}

	for ( int i = 0; i < vCircle.size(); i++ )
	{
		CircleShape* Circle = vCircle[ i ];
		body->DestroyFixture( &Circle->GetFixture() );
		Circle->SetRadius( SizeBody.x/2 );
		Circle->SetFixture( body->CreateFixture( &Circle->GetFixtureDef() ) );
	}

	body->GetFixtureList()->SetFilterData( *Filter );
}