| 470 | } |
| 471 | |
| 472 | void demo4Create() { |
| 473 | PhysicsManager::DrawSpaceOptions* DSO = PhysicsManager::instance()->getDrawOptions(); |
| 474 | DSO->DrawBBs = false; |
| 475 | DSO->DrawShapes = true; |
| 476 | DSO->DrawShapesBorders = false; |
| 477 | DSO->CollisionPointSize = 0; |
| 478 | DSO->BodyPointSize = 0; |
| 479 | DSO->LineThickness = 0; |
| 480 | |
| 481 | createJointAndBody(); |
| 482 | |
| 483 | mWindow->setTitle( "eepp - Physics - Sticky collisions using the Arbiter data pointer." ); |
| 484 | |
| 485 | mSpace = Space::New(); |
| 486 | mSpace->setIterations( 10 ); |
| 487 | mSpace->setGravity( cVectNew( 0, 1000 ) ); |
| 488 | mSpace->setCollisionSlop( 2.0 ); |
| 489 | |
| 490 | Body* staticBody = mSpace->getStaticBody(); |
| 491 | Shape* shape; |
| 492 | |
| 493 | cpFloat x = 500; |
| 494 | cpFloat y = 400; |
| 495 | |
| 496 | shape = mSpace->addShape( ShapeSegment::New( staticBody, cVectNew( x + -340, y - 260 ), |
| 497 | cVectNew( x - 340, y + 260 ), 20.0f ) ); |
| 498 | shape->setElasticity( 1.0f ); |
| 499 | shape->setFriction( 1.0f ); |
| 500 | shape->setCollisionType( COLLIDE_STICK_SENSOR ); |
| 501 | shape->setLayers( NOT_GRABABLE_MASK ); |
| 502 | |
| 503 | shape = mSpace->addShape( ShapeSegment::New( staticBody, cVectNew( x + 340, y - 260 ), |
| 504 | cVectNew( x + 340, y + 260 ), 20.0f ) ); |
| 505 | shape->setElasticity( 1.0f ); |
| 506 | shape->setFriction( 1.0f ); |
| 507 | shape->setCollisionType( COLLIDE_STICK_SENSOR ); |
| 508 | shape->setLayers( NOT_GRABABLE_MASK ); |
| 509 | |
| 510 | shape = mSpace->addShape( ShapeSegment::New( staticBody, cVectNew( x - 340, y - 260 ), |
| 511 | cVectNew( x + 340, y - 260 ), 20.0f ) ); |
| 512 | shape->setElasticity( 1.0f ); |
| 513 | shape->setFriction( 1.0f ); |
| 514 | shape->setCollisionType( COLLIDE_STICK_SENSOR ); |
| 515 | shape->setLayers( NOT_GRABABLE_MASK ); |
| 516 | |
| 517 | shape = mSpace->addShape( ShapeSegment::New( staticBody, cVectNew( x - 340, y + 260 ), |
| 518 | cVectNew( x + 340, y + 260 ), 20.0f ) ); |
| 519 | shape->setElasticity( 1.0f ); |
| 520 | shape->setFriction( 1.0f ); |
| 521 | shape->setCollisionType( COLLIDE_STICK_SENSOR ); |
| 522 | shape->setLayers( NOT_GRABABLE_MASK ); |
| 523 | |
| 524 | for ( int i = 0; i < 200; i++ ) { |
| 525 | cpFloat mass = 0.15f; |
| 526 | cpFloat radius = 10.0f; |
| 527 | |
| 528 | Body* body = mSpace->addBody( |
| 529 | Body::New( mass, Moment::forCircle( mass, 0.0f, radius, cVectZero ) ) ); |
nothing calls this directly
no test coverage detected