lullaby/tests/physics_system_test.cc
// Test that Static objects don't move even if their transform is updated.
Test that Static objects don't move even if their transform is updated.
Test that Static objects don ' t move even if their transform is updated .
TEST_F(PhysicsSystemTest, StaticBody) {
  auto* physics_system = registry_->Get<PhysicsSystem>();
  auto* transform_system = registry_->Get<TransformSystem>();
  const Entity origin = CreateBasicRigidBody(
      mathfu::kZeros3f, RigidBodyType::RigidBodyType_Static,
      ColliderType::ColliderType_Trigger);
  EXPECT_THAT(origin, Ne(kNullEntity));
  const Entity above = CreateBasicRigidBody(
      mathfu::vec3(0.f, 3.f, 0.f), RigidBodyType::RigidBodyType_Static,
      ColliderType::ColliderType_Trigger);
  EXPECT_THAT(above, Ne(kNullEntity));
  physics_system->AdvanceFrame(kFrameDuration);
  EXPECT_FALSE(physics_system->AreInContact(origin, above));
  transform_system->SetLocalTranslation(above, mathfu::vec3(0.f, 1.f, 0.f));
  physics_system->AdvanceFrame(kFrameDuration);
  EXPECT_FALSE(physics_system->AreInContact(origin, above));
  transform_system->SetLocalScale(above, 100.f * mathfu::kOnes3f);
  physics_system->AdvanceFrame(kFrameDuration);
  EXPECT_FALSE(physics_system->AreInContact(origin, above));
}
TEST_F ( PhysicsSystemTest , StaticBody ) { auto * physics_system = registry_ -> Get < PhysicsSystem > ( ) ; auto * transform_system = registry_ -> Get < TransformSystem > ( ) ; const Entity origin = CreateBasicRigidBody ( mathfu :: kZeros3f , RigidBodyType :: RigidBodyType_Static , ColliderType :: ColliderType_Trigger ) ; EXPECT_THAT ( origin , Ne ( kNullEntity ) ) ; const Entity above = CreateBasicRigidBody ( mathfu :: vec3 ( 0.f , 3.f , 0.f ) , RigidBodyType :: RigidBodyType_Static , ColliderType :: ColliderType_Trigger ) ; EXPECT_THAT ( above , Ne ( kNullEntity ) ) ; physics_system -> AdvanceFrame ( kFrameDuration ) ; EXPECT_FALSE ( physics_system -> AreInContact ( origin , above ) ) ; transform_system -> SetLocalTranslation ( above , mathfu :: vec3 ( 0.f , 1.f , 0.f ) ) ; physics_system -> AdvanceFrame ( kFrameDuration ) ; EXPECT_FALSE ( physics_system -> AreInContact ( origin , above ) ) ; transform_system -> SetLocalScale ( above , 100.f * mathfu :: kOnes3f ) ; physics_system -> AdvanceFrame ( kFrameDuration ) ; EXPECT_FALSE ( physics_system -> AreInContact ( origin , above ) ) ; }
Test that Static objects don't move even if their transform is updated.
Test that Static objects don ' t move even if their transform is updated .
// Create a Static Trigger box at the origin. // Create a Static Trigger box above the origin and out of contact with the // other box. // Advance the PhysicsSystem and confirm they are not in contact. // Move the second object down into contact, then re-do contact tests and // ensure nothing changes because it is Static. // Scaling the box to an enourmous size won't make a difference either.