lullaby/tests/physics_system_test.cc
// Test that scale changes take effect.
Test that scale changes take effect.
Test that scale changes take effect .
TEST_F(PhysicsSystemTest, ScaleChange) {
  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 kinematic = CreateBasicRigidBody(
      mathfu::vec3(0.f, 3.f, 0.f), RigidBodyType::RigidBodyType_Kinematic,
      ColliderType::ColliderType_Trigger);
  EXPECT_THAT(kinematic, Ne(kNullEntity));
  physics_system->AdvanceFrame(kFrameDuration);
  EXPECT_FALSE(physics_system->AreInContact(origin, kinematic));
  transform_system->SetLocalScale(kinematic, 4.f * mathfu::kOnes3f);
  physics_system->AdvanceFrame(kFrameDuration);
  EXPECT_TRUE(physics_system->AreInContact(origin, kinematic));
  transform_system->SetLocalScale(kinematic, mathfu::kOnes3f);
  physics_system->AdvanceFrame(kFrameDuration);
  EXPECT_FALSE(physics_system->AreInContact(origin, kinematic));
}
TEST_F ( PhysicsSystemTest , ScaleChange ) { 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 kinematic = CreateBasicRigidBody ( mathfu :: vec3 ( 0.f , 3.f , 0.f ) , RigidBodyType :: RigidBodyType_Kinematic , ColliderType :: ColliderType_Trigger ) ; EXPECT_THAT ( kinematic , Ne ( kNullEntity ) ) ; physics_system -> AdvanceFrame ( kFrameDuration ) ; EXPECT_FALSE ( physics_system -> AreInContact ( origin , kinematic ) ) ; transform_system -> SetLocalScale ( kinematic , 4.f * mathfu :: kOnes3f ) ; physics_system -> AdvanceFrame ( kFrameDuration ) ; EXPECT_TRUE ( physics_system -> AreInContact ( origin , kinematic ) ) ; transform_system -> SetLocalScale ( kinematic , mathfu :: kOnes3f ) ; physics_system -> AdvanceFrame ( kFrameDuration ) ; EXPECT_FALSE ( physics_system -> AreInContact ( origin , kinematic ) ) ; }
Test that scale changes take effect.
Test that scale changes take effect .
// Create a Static Trigger box at the origin. // Create a 2x2x2 Kinematic Trigger box above the origin and out of contact // with the first Entity. // Advance the PhysicsSystem and confirm they are not in contact. // Scale the kinematic object into contact and advance the PhysicsSystem. // Scale the kinematic object out of contact and advance the PhysicsSystem.