Tag Info

Hot answers tagged

4

GLM's rotation function uses Euler's rotation theorem, which implies that any rotation or sequence of rotations of a rigid body in a three-dimensional space is equivalent to a pure rotation about a single fixed axis. However consecutive calls to GLMs rotate function just multiply the rotation so rotating a rigid body by Yaw, Pitch, Roll is as simple as ...


4

You need to read the error message more carefully: In file included from jni/src/GLIncludes.h:41:0, from jni/androidLauncher.cpp:4: jni/src/glm/glm.hpp:86:18: fatal error: limits: No such file or directory As you can see, the glm.hpp header is found. It's limits that is not found, because by default the NDK uses a stripped-down C++ ...


2

Place your camera target at the center of the arc rotation (That's usually where you want the camera to look anyway). Then simply transform the camera's position around the target with a rotation that uses the appropriate axis. pseudo code: //some angle & some other angle = only the amount you want the camera to rotate since last frame. //pitch ...


2

Thanks to @DaleyPaley I was able to figure this out. The problem lay in my code to figure out the camera vectors Right, Up, and Back. I was just using some code that I found online, and once I started showing the actual camera placement and vectors from the perspective of a hardcoded camera, I could tell that the vectors being produced by Right, Up, and Back ...


1

How can I calculate intersection with my scene geometries? it varies depending on your performance needs and scene size, there are different approaches the easiest one is checking ray intersection with all bounding volumes containing geometry in the scene, however this may not be good enough if your scene is huge, or you have limited computational ...


1

For me, this code looks flawed: glm::mat4 model = glm::mat4(1.0f); model *= glm::translate(model, glm::vec3(0.0f, 0.0f, 0.0f)); model *= glm::rotate(model, angle, glm::vec3(1.0f, 1.0f, 1.0f)); The modelviewmatrix you are creating seems to me to be like something as this: M = I * T * (T * R) (since glm::rotate(model, ...) creates the matrix T * R) but I ...


1

Given your description, your camera representation might look like this. I also included the headers of your maths library GLM needed for the following implementation. #include <glm/glm.hpp> #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/constants.hpp> using namespace glm; struct Camera { vec3 Position; vec2 Angles; ...


1

The best way to do that is to generate a vector in the direction your camera is pointing. The simplest way to do it would be to rotate it around the corresponding axes: Vec3 GetCameraDir(float horiz, float vert) { // Start out pointing to the right Vec3 dir = Vec3 (1, 0, 0); // Rotate dir around the Y axis by your horizontal angle dir = ...


1

The angles used to build a rotation for each of the three axes are known as Tait-Bryan angles (often confused with Euler angles). Wikipedia has all the formulas you need to convert Euler or Tait-Bryan angles into a rotation matrix. Here is some code to build a rotation matrix from three Tait-Bryan angles and the order of the rotations: /* i, j and k are ...


1

Answer: Thanks for your help guys. I just kept track and updated the position and heading variable separately from the view matrix. glm::vec3 m_position; glm::vec3 m_direction; ... // speed is usually 0.1f or something small like that void camera::rotate(float amount, glm::vec3& axis) { m_direction = glm::rotate(m_direction, amount * m_speed, ...



Only top voted, non community-wiki answers of a minimum length are eligible