Physics working
This commit is contained in:
@@ -26,11 +26,12 @@ bool HydraGame::Initialise()
|
||||
|
||||
m_cube_actor_id = GetEngine()->ActorManager()->CreateActor<HydraTestCubeActor>();
|
||||
GetEngine()->ActorManager()->InitialiseActor(m_cube_actor_id);
|
||||
GetEngine()->ActorManager()->SetPosition(m_cube_actor_id, glm::dvec3(0, 1.0, 0));
|
||||
GetEngine()->ActorManager()->SetPosition(m_cube_actor_id, glm::dvec3(0, 20.0, 0));
|
||||
|
||||
m_plane_actor_id = GetEngine()->ActorManager()->CreateActor<HydraPlaneActor>();
|
||||
GetEngine()->ActorManager()->InitialiseActor(m_plane_actor_id);
|
||||
GetEngine()->ActorManager()->SetPosition(m_plane_actor_id, glm::dvec3(0, 0, 0));
|
||||
|
||||
|
||||
// m_plane_actor_id1 = GetEngine()->ActorManager()->CreateActor<HydraPlaneActor>();
|
||||
// GetEngine()->ActorManager()->InitialiseActor(m_plane_actor_id1);
|
||||
@@ -63,38 +64,7 @@ bool HydraGame::Initialise()
|
||||
|
||||
void HydraGame::Update(float delta_t_seconds)
|
||||
{
|
||||
if (GetEngine()->KeyPressed(HYDRA_KEY_CODES::HYDRA_KEY_ESCAPE))
|
||||
{
|
||||
GetEngine()->Exit();
|
||||
}
|
||||
|
||||
if (GetEngine()->KeyPressed(HYDRA_KEY_CODES::HYDRA_KEY_0))
|
||||
{
|
||||
GetEngine()->ActorManager()->DeleteActor(m_sun_light_id);
|
||||
}
|
||||
if (GetEngine()->KeyPressed(HYDRA_KEY_CODES::HYDRA_KEY_9))
|
||||
{
|
||||
if (m_spot_light_id == INVALID_HYDRA_ID)
|
||||
{
|
||||
m_point_light_id = GetEngine()->ActorManager()->CreateActor<HydraPointLightActor>();
|
||||
GetEngine()->ActorManager()->InitialiseActor(m_point_light_id);
|
||||
GetEngine()->ActorManager()->SetPosition(m_point_light_id, glm::dvec3(2.0f, 3.0f, 2.0f));
|
||||
|
||||
m_spot_light_id = GetEngine()->ActorManager()->CreateActor<HydraSpotLightActor>();
|
||||
GetEngine()->ActorManager()->InitialiseActor(m_spot_light_id);
|
||||
GetEngine()->ActorManager()->SetOrientation(m_spot_light_id, -0.5f, -0.2f, 0.0f);
|
||||
GetEngine()->ActorManager()->SetPosition(m_spot_light_id, glm::dvec3(0.0f, 4.0f, 5.0f));
|
||||
}
|
||||
}
|
||||
if (GetEngine()->KeyPressed(HYDRA_KEY_CODES::HYDRA_KEY_8))
|
||||
{
|
||||
if (m_point_light_id == INVALID_HYDRA_ID)
|
||||
{
|
||||
m_point_light_id = GetEngine()->ActorManager()->CreateActor<HydraPointLightActor>();
|
||||
GetEngine()->ActorManager()->InitialiseActor(m_point_light_id);
|
||||
GetEngine()->ActorManager()->SetPosition(m_point_light_id, glm::dvec3(2.0f, 3.0f, 2.0f));
|
||||
}
|
||||
}
|
||||
|
||||
// GetEngine()->ActorManager()->SetOrientation(m_sun_light_id, m_angle, 0.4, 0.0f);
|
||||
// if(m_angle > (M_PI) - 0.01)
|
||||
// {
|
||||
@@ -105,4 +75,43 @@ void HydraGame::Update(float delta_t_seconds)
|
||||
// GetEngine()->ActorManager()->SetOrientation(m_other_light_id, -0.5f, m_angle, 0);
|
||||
// GetEngine()->ActorManager()->SetOrientation(m_gltf_id, 0, m_angle, 0);
|
||||
// GetEngine()->ActorManager()->SetOrientation(m_plane_actor_id, 0, m_angle, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void HydraGame::FixedUpdate(float delta_t_seconds)
|
||||
{
|
||||
if (GetEngine()->KeyDown(HYDRA_KEY_CODES::HYDRA_KEY_ESCAPE))
|
||||
{
|
||||
GetEngine()->Exit();
|
||||
}
|
||||
|
||||
if (GetEngine()->KeyDown(HYDRA_KEY_CODES::HYDRA_KEY_0))
|
||||
{
|
||||
GetEngine()->ActorManager()->DeleteActor(m_sun_light_id);
|
||||
}
|
||||
if (GetEngine()->KeyDown(HYDRA_KEY_CODES::HYDRA_KEY_9))
|
||||
{
|
||||
if (m_spot_light_id == INVALID_HYDRA_ID)
|
||||
{
|
||||
|
||||
m_spot_light_id = GetEngine()->ActorManager()->CreateActor<HydraSpotLightActor>();
|
||||
GetEngine()->ActorManager()->InitialiseActor(m_spot_light_id);
|
||||
GetEngine()->ActorManager()->SetOrientation(m_spot_light_id, -0.5f, -0.2f, 0.0f);
|
||||
GetEngine()->ActorManager()->SetPosition(m_spot_light_id, glm::dvec3(0.0f, 4.0f, 5.0f));
|
||||
}
|
||||
}
|
||||
|
||||
if (GetEngine()->KeyDown(HYDRA_KEY_CODES::HYDRA_KEY_8))
|
||||
{
|
||||
if (m_point_light_id == INVALID_HYDRA_ID)
|
||||
{
|
||||
m_point_light_id = GetEngine()->ActorManager()->CreateActor<HydraPointLightActor>();
|
||||
GetEngine()->ActorManager()->InitialiseActor(m_point_light_id);
|
||||
GetEngine()->ActorManager()->SetPosition(m_point_light_id, glm::dvec3(2.0f, 3.0f, 2.0f));
|
||||
}
|
||||
else
|
||||
{
|
||||
GetEngine()->ActorManager()->DeleteActor(m_point_light_id);
|
||||
m_point_light_id = INVALID_HYDRA_ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,9 @@ class HydraGame : public HydraGameProxy
|
||||
public:
|
||||
virtual bool Initialise() override;
|
||||
virtual void Update(float delta_t_seconds) override;
|
||||
|
||||
virtual void FixedUpdate(float delta_t_seconds) override;
|
||||
};
|
||||
|
||||
|
||||
#endif /* HYDRAGAME */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user