| 22 | Ref<RavEngine::Material> TestEntity::sharedMatInstance; |
| 23 | |
| 24 | TestEntity::TestEntity() : Entity(){ |
| 25 | |
| 26 | //attach the script |
| 27 | auto script = AddComponent<TestEntityController>(new TestEntityController()); |
| 28 | |
| 29 | //set the filter layers |
| 30 | auto r = AddComponent<RigidBodyDynamicComponent>(new RigidBodyDynamicComponent(FilterLayers::L0,FilterLayers::L0 | FilterLayers::L1)); |
| 31 | r->AddReceiver(script.get()); |
| 32 | |
| 33 | //add a box collision to the PhysX component |
| 34 | if (sharedMat.isNull()) { |
| 35 | sharedMat = new PhysicsMaterial(0.5, 0.5, 0.5); |
| 36 | } |
| 37 | AddComponent<BoxCollider>(new BoxCollider(vector3(1, 1, 1),sharedMat)); |
| 38 | |
| 39 | //default staticmesh |
| 40 | auto mesh = AddComponent<StaticMesh>(new StaticMesh()); |
| 41 | if (sharedMatInstance.isNull()) { |
| 42 | if (MaterialManager::HasMaterialByName("defaultMaterial")) { |
| 43 | sharedMatInstance = MaterialManager::GetMaterialByName("defaultMaterial"); |
| 44 | } |
| 45 | else { |
| 46 | sharedMatInstance = new Material(); |
| 47 | } |
| 48 | } |
| 49 | mesh->SetMaterial(sharedMatInstance); |
| 50 | } |
| 51 | |
| 52 | void TestEntityController::Tick(float scale) { |
| 53 |
nothing calls this directly
no test coverage detected