add y axis
This commit is contained in:
parent
aaef2a0ea2
commit
b8e72defc7
@ -60,7 +60,7 @@
|
|||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
@ -119,21 +119,22 @@ void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint a
|
|||||||
void processInput(GLFWwindow* window)
|
void processInput(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
float cameraSpeed = 0.1f * deltaTime * 15;
|
||||||
|
if (engineIs == 2)
|
||||||
|
//cameraSpeed = cameraSpeed * 1.8;//1.5;
|
||||||
|
cameraSpeed = 0.1f * deltaTime * 15 * 1.8;
|
||||||
|
|
||||||
if (!glfwJoystickIsGamepad(GLFW_JOYSTICK_1)) {
|
if (!glfwJoystickIsGamepad(GLFW_JOYSTICK_1)) {
|
||||||
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
|
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
|
||||||
glfwSetWindowShouldClose(window, true);
|
glfwSetWindowShouldClose(window, true);
|
||||||
float cameraSpeed = 0.1f * deltaTime * 15;
|
|
||||||
|
|
||||||
|
|
||||||
//station glm::vec3(0.f, 0.4f, 4.f)
|
//station glm::vec3(0.f, 0.4f, 4.f)
|
||||||
if (engineIs==1&&spaceshipPos.x > -0.7 && 0.3>spaceshipPos.x && spaceshipPos.z > 3.7 && 4.3>spaceshipPos.z)
|
if (engineIs==1&&spaceshipPos.x > -0.7 && 0.3>spaceshipPos.x && spaceshipPos.z > 3.7 && 4.3>spaceshipPos.z&& spaceshipPos.y > -0.7 && 0.3 > spaceshipPos.y)
|
||||||
{
|
{
|
||||||
if (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS)
|
if (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS)
|
||||||
engineIs = 2;
|
engineIs = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engineIs == 2)
|
|
||||||
cameraSpeed = cameraSpeed * 1.8;//1.5;
|
|
||||||
|
|
||||||
|
|
||||||
if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
|
if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
|
||||||
@ -146,6 +147,12 @@ void processInput(GLFWwindow* window)
|
|||||||
spaceshipDir = glm::vec3(glm::eulerAngleY(-cameraSpeed) * glm::vec4(spaceshipDir, 0));
|
spaceshipDir = glm::vec3(glm::eulerAngleY(-cameraSpeed) * glm::vec4(spaceshipDir, 0));
|
||||||
|
|
||||||
}else if (glfwGetGamepadState(GLFW_JOYSTICK_1, ¤tState)) {
|
}else if (glfwGetGamepadState(GLFW_JOYSTICK_1, ¤tState)) {
|
||||||
|
//station glm::vec3(0.f, 0.4f, 4.f)
|
||||||
|
if (engineIs == 1 && spaceshipPos.x > -0.7 && 0.3 > spaceshipPos.x && spaceshipPos.z > 3.7 && 4.3 > spaceshipPos.z && spaceshipPos.y > 0.1 && 0.7 > spaceshipPos.y)
|
||||||
|
{
|
||||||
|
if (currentState.buttons[GLFW_GAMEPAD_BUTTON_A]==GLFW_PRESS)
|
||||||
|
engineIs = 2;
|
||||||
|
}
|
||||||
if(currentState.axes[GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER] > 0.01)
|
if(currentState.axes[GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER] > 0.01)
|
||||||
spaceshipPos += deltaTime * 5 * spaceshipDir * currentState.axes[GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER];
|
spaceshipPos += deltaTime * 5 * spaceshipDir * currentState.axes[GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER];
|
||||||
if (currentState.axes[GLFW_GAMEPAD_AXIS_LEFT_TRIGGER] > 0.01)
|
if (currentState.axes[GLFW_GAMEPAD_AXIS_LEFT_TRIGGER] > 0.01)
|
||||||
@ -278,12 +285,15 @@ void isTouching(glm::vec3 objectPos) {
|
|||||||
//spaceXYZ = glm::vec3(float x, float y, float z);
|
//spaceXYZ = glm::vec3(float x, float y, float z);
|
||||||
float xpos = spaceshipPos.x;
|
float xpos = spaceshipPos.x;
|
||||||
float zpos = spaceshipPos.z;
|
float zpos = spaceshipPos.z;
|
||||||
|
float ypos = spaceshipPos.y;
|
||||||
float xup = objectPos.x+0.2;
|
float xup = objectPos.x+0.2;
|
||||||
float xdown = objectPos.x-0.2;
|
float xdown = objectPos.x-0.2;
|
||||||
float zup = objectPos.z+0.2;
|
float zup = objectPos.z+0.2;
|
||||||
float zdown = objectPos.z-0.2;
|
float zdown = objectPos.z-0.2;
|
||||||
|
float yup = objectPos.y + 0.4;
|
||||||
|
float ydown = objectPos.y - 0.4;
|
||||||
//6,0,0
|
//6,0,0
|
||||||
if (xup > xpos&&xpos > xdown && zup > zpos &&zpos > zdown)
|
if (xup >= xpos&&xpos >= xdown && zup >= zpos &&zpos >= zdown && ypos >= ydown && yup >= ypos)
|
||||||
//if(xpos>6&&1>zpos&&zpos>-1)
|
//if(xpos>6&&1>zpos&&zpos>-1)
|
||||||
engineIs = 1;
|
engineIs = 1;
|
||||||
return;
|
return;
|
||||||
@ -349,7 +359,7 @@ void renderScene(GLFWwindow* window) {
|
|||||||
drawObjectToInstall(stationContext, glm::translate(glm::vec3(0.f, 0.4f, 4.f)) * glm::scale(glm::vec3(0.052f)) * glm::eulerAngleXYZ(time / 2, time / 2, time / 2), texture::station_albedo, texture::station_normal, texture::station_ao, texture::station_roughness, texture::station_metallic);
|
drawObjectToInstall(stationContext, glm::translate(glm::vec3(0.f, 0.4f, 4.f)) * glm::scale(glm::vec3(0.052f)) * glm::eulerAngleXYZ(time / 2, time / 2, time / 2), texture::station_albedo, texture::station_normal, texture::station_ao, texture::station_roughness, texture::station_metallic);
|
||||||
drawObjectToInstall(stationContext, glm::translate(glm::vec3(0.f, 0.4f, 4.f)) * glm::scale(glm::vec3(0.054f)) * glm::eulerAngleX(0.5f) * glm::eulerAngleXZ(time, time), texture::station_albedo, texture::station_normal, texture::station_ao, texture::station_roughness, texture::station_metallic);
|
drawObjectToInstall(stationContext, glm::translate(glm::vec3(0.f, 0.4f, 4.f)) * glm::scale(glm::vec3(0.054f)) * glm::eulerAngleX(0.5f) * glm::eulerAngleXZ(time, time), texture::station_albedo, texture::station_normal, texture::station_ao, texture::station_roughness, texture::station_metallic);
|
||||||
|
|
||||||
if (spaceshipPos.x > -0.7 && 0.3 > spaceshipPos.x && spaceshipPos.z > 3.7 && 4.3 > spaceshipPos.z)
|
if (spaceshipPos.x > -0.7 && 0.3 > spaceshipPos.x && spaceshipPos.z > 3.7 && 4.3 > spaceshipPos.z && spaceshipPos.y > -0.7 && 0.3 > spaceshipPos.y)
|
||||||
{
|
{
|
||||||
drawObjectToInstall(shipContext,
|
drawObjectToInstall(shipContext,
|
||||||
glm::translate(spaceshipPos)
|
glm::translate(spaceshipPos)
|
||||||
|
Loading…
Reference in New Issue
Block a user