TargetActor.cpp 837 B

123456789101112131415161718192021222324252627
  1. // ----------------------------------------------------------------
  2. // From Game Programming in C++ by Sanjay Madhav
  3. // Copyright (C) 2017 Sanjay Madhav. All rights reserved.
  4. //
  5. // Released under the BSD License
  6. // See LICENSE in root directory for full details.
  7. // ----------------------------------------------------------------
  8. #include "TargetActor.h"
  9. #include "Game.h"
  10. #include "Renderer.h"
  11. #include "MeshComponent.h"
  12. #include "BoxComponent.h"
  13. #include "Mesh.h"
  14. TargetActor::TargetActor(Game* game)
  15. :Actor(game)
  16. {
  17. //SetScale(10.0f);
  18. SetRotation(Quaternion(Vector3::UnitZ, Math::Pi));
  19. MeshComponent* mc = new MeshComponent(this);
  20. Mesh* mesh = GetGame()->GetRenderer()->GetMesh("Assets/Target.gpmesh");
  21. mc->SetMesh(mesh);
  22. // Add collision box
  23. BoxComponent* bc = new BoxComponent(this);
  24. bc->SetObjectBox(mesh->GetBox());
  25. }