Skip to content

Commit

Permalink
Added groups
Browse files Browse the repository at this point in the history
  • Loading branch information
denis authored and denis committed Feb 9, 2025
1 parent 7f18357 commit 1e66607
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions UserEngine/include/PlayerController.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "../../Engine/include/GlobalData/GlobalData.h"
#include "../../Engine/include/Components/PhysicsMeshComponent.h"
#include "ParticleController.h"
#include "../../Engine/include/Helpers/Interpolator.h"

class PlayerController
{
Expand Down Expand Up @@ -109,4 +110,8 @@ class PlayerController
ParticleController m_particleController;

std::vector<std::shared_ptr<Prisma::Mesh>> m_balls;

Prisma::Interpolator m_interpolator;

std::shared_ptr<Prisma::Node> m_areaLight;
};
15 changes: 15 additions & 0 deletions UserEngine/src/PlayerController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,21 @@ PlayerController::PlayerController(std::shared_ptr<Prisma::Scene> scene) : m_sce
m_physics->onCollisionStay(contact);
m_physics->onCollisionExit(noContact);

glm::mat4 rotation = glm::rotate(glm::mat4(1.0), glm::radians(90.0f), glm::vec3(1, 0, 0))*glm::translate(glm::mat4(1.0),glm::vec3(0,0,-1));

std::vector<Prisma::Interpolator::Timeframe> timeframes;
float amplitude = 1.0f;
float frequency = 2.0f;
for (int i = 0; i <= 10; ++i) {
float t = static_cast<float>(i) / 10.0f * glm::pi<float>() * 2.0f;
float x = std::cos(t) * amplitude;
float y = std::sin(t) * amplitude;
timeframes.push_back({ rotation * glm::translate(glm::mat4(1.0f), glm::vec3(x, y, 0.0f)), 1.0f });
}

m_interpolator.timeframe(timeframes);

m_areaLight = nodeHelper.find(m_scene->root, "ParentArea_74");

createCamera();
createKeyboard();
Expand Down Expand Up @@ -194,6 +208,7 @@ void PlayerController::update()
ball->addComponent(shockwaveComponent);
}
m_balls.clear();
m_areaLight->matrix(m_interpolator.next(1.0 / Prisma::Engine::getInstance().fps()));
}

std::shared_ptr<Prisma::CallbackHandler> PlayerController::callback()
Expand Down

0 comments on commit 1e66607

Please sign in to comment.