MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / TestEntity

Method TestEntity

RavEngine_Test/TestEntity.cpp:24–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22Ref<RavEngine::Material> TestEntity::sharedMatInstance;
23
24TestEntity::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
52void TestEntityController::Tick(float scale) {
53

Callers

nothing calls this directly

Calls 4

AddReceiverMethod · 0.80
SetMaterialMethod · 0.80
getMethod · 0.45
isNullMethod · 0.45

Tested by

no test coverage detected