@@ -58,6 +58,7 @@ void Game::start(Scene* s) {
5858 scene->addGameObject (sphere);
5959
6060 auto * rigidbodyPrefab = new RigidbodyPrefab (scene);
61+ rigidbodyPrefab->mesh ->setColor ({ 1 .0f , 0 .0f , 0 , 1 .0f });
6162 scene->addGameObject (rigidbodyPrefab);
6263 rigidbodyPrefab->transform .positionX = -1.5 ;
6364 rigidbodyPrefab->transform .positionY = 3 ;
@@ -69,6 +70,7 @@ void Game::start(Scene* s) {
6970 rigidbodyPrefab->addComponent (rigidbodyCuboidRectangleCollider);
7071
7172 auto * rigidbodyPrefab2 = new RigidbodyPrefab (scene);
73+ rigidbodyPrefab2->mesh ->setColor ({ 0 , 0 .0f , 0 .8f , 1 .0f });
7274 rigidbodyPrefab2->transform .positionX = 1.5 ;
7375 rigidbodyPrefab2->transform .positionY = 3 ;
7476 rigidbodyPrefab2->transform .positionZ = -3 ;
@@ -80,6 +82,7 @@ void Game::start(Scene* s) {
8082 rigidbodyPrefab2->addComponent (rigidbodyCuboidRectangleCollider2);
8183
8284 auto * rigidbodyPrefab3 = new RigidbodyPrefab (scene);
85+ rigidbodyPrefab3->mesh ->setColor ({ 0 , 0 .8f , 0 , 1 .0f });
8386 rigidbodyPrefab3->transform .positionX = 3 ;
8487 rigidbodyPrefab3->transform .positionY = 3 ;
8588 rigidbodyPrefab3->transform .positionZ = 0 ;
@@ -91,78 +94,78 @@ void Game::start(Scene* s) {
9194 rigidbodyPrefab3->addComponent (rigidbodyCuboidRectangleCollider3);
9295}
9396
94- // void Game::goLeft() {
95- // // m_p->setSpeed(-m_speed, 0, 0);
97+ // void Game::goLeft() {
98+ // // m_p->setSpeed(-m_speed, 0, 0);
9699//
97- // for (auto& gameObject : scene->getGameObjects())
98- // {
99- // auto* particle = dynamic_cast<Particle*>(gameObject->getComponentByName(PARTICLE_COMPONENT));
100- // if (particle != nullptr)
101- // {
102- // AnchoredSpring* anchoredSpring;
103- // particle->getForceByClass(anchoredSpring);
104- // if (anchoredSpring != nullptr)
105- // {
106- // anchoredSpring->translate({ -m_speed, 0, 0 });
107- // }
108- // }
109- // }
110- // }
100+ // for (auto& gameObject : scene->getGameObjects())
101+ // {
102+ // auto* particle = dynamic_cast<Particle*>(gameObject->getComponentByName(PARTICLE_COMPONENT));
103+ // if (particle != nullptr)
104+ // {
105+ // AnchoredSpring* anchoredSpring;
106+ // particle->getForceByClass(anchoredSpring);
107+ // if (anchoredSpring != nullptr)
108+ // {
109+ // anchoredSpring->translate({ -m_speed, 0, 0 });
110+ // }
111+ // }
112+ // }
113+ // }
111114//
112- // void Game::goRight() {
113- // // m_p->setSpeed(m_speed, 0, 0);
115+ // void Game::goRight() {
116+ // // m_p->setSpeed(m_speed, 0, 0);
114117//
115- // for (auto& gameObject : scene->getGameObjects())
116- // {
117- // auto* particle = dynamic_cast<Particle*>(gameObject->getComponentByName(PARTICLE_COMPONENT));
118- // if (particle != nullptr)
119- // {
120- // AnchoredSpring* anchoredSpring;
121- // particle->getForceByClass(anchoredSpring);
122- // if (anchoredSpring != nullptr)
123- // {
124- // anchoredSpring->translate({ m_speed, 0, 0 });
125- // }
126- // }
127- // }
128- // }
118+ // for (auto& gameObject : scene->getGameObjects())
119+ // {
120+ // auto* particle = dynamic_cast<Particle*>(gameObject->getComponentByName(PARTICLE_COMPONENT));
121+ // if (particle != nullptr)
122+ // {
123+ // AnchoredSpring* anchoredSpring;
124+ // particle->getForceByClass(anchoredSpring);
125+ // if (anchoredSpring != nullptr)
126+ // {
127+ // anchoredSpring->translate({ m_speed, 0, 0 });
128+ // }
129+ // }
130+ // }
131+ // }
129132//
130- // void Game::goUp() {
131- // // m_p->setSpeed(0, m_speed, 0);
133+ // void Game::goUp() {
134+ // // m_p->setSpeed(0, m_speed, 0);
132135//
133- // for (auto& gameObject : scene->getGameObjects())
134- // {
135- // auto* particle = dynamic_cast<Particle*>(gameObject->getComponentByName(PARTICLE_COMPONENT));
136- // if (particle != nullptr)
137- // {
138- // AnchoredSpring* anchoredSpring;
139- // particle->getForceByClass(anchoredSpring);
140- // if (anchoredSpring != nullptr)
141- // {
142- // anchoredSpring->translate({ 0, m_speed, 0 });
143- // }
144- // }
145- // }
146- // }
136+ // for (auto& gameObject : scene->getGameObjects())
137+ // {
138+ // auto* particle = dynamic_cast<Particle*>(gameObject->getComponentByName(PARTICLE_COMPONENT));
139+ // if (particle != nullptr)
140+ // {
141+ // AnchoredSpring* anchoredSpring;
142+ // particle->getForceByClass(anchoredSpring);
143+ // if (anchoredSpring != nullptr)
144+ // {
145+ // anchoredSpring->translate({ 0, m_speed, 0 });
146+ // }
147+ // }
148+ // }
149+ // }
147150//
148- // void Game::goDown() {
149- // // m_p->setSpeed(0, -m_speed, 0);
151+ // void Game::goDown() {
152+ // // m_p->setSpeed(0, -m_speed, 0);
150153//
151- // for (auto& gameObject : scene->getGameObjects())
152- // {
153- // auto* particle = dynamic_cast<Particle*>(gameObject->getComponentByName(PARTICLE_COMPONENT));
154- // if (particle != nullptr)
155- // {
156- // AnchoredSpring* anchoredSpring;
157- // particle->getForceByClass(anchoredSpring);
158- // if (anchoredSpring != nullptr)
159- // {
160- // anchoredSpring->translate({ 0, -m_speed, 0 });
161- // }
162- // }
163- // }
164- // }
154+ // for (auto& gameObject : scene->getGameObjects())
155+ // {
156+ // auto* particle = dynamic_cast<Particle*>(gameObject->getComponentByName(PARTICLE_COMPONENT));
157+ // if (particle != nullptr)
158+ // {
159+ // AnchoredSpring* anchoredSpring;
160+ // particle->getForceByClass(anchoredSpring);
161+ // if (anchoredSpring != nullptr)
162+ // {
163+ // anchoredSpring->translate({ 0, -m_speed, 0 });
164+ // }
165+ // }
166+ // }
167+ // }
165168
166- // float* Game::getPtrSpeed() {
167- // return &m_speed;
168- // }
169+ // float* Game::getPtrSpeed() {
170+ // return &m_speed;
171+ // }
0 commit comments