Jump to content
  • Advertisement

Sword7

Member
  • Content Count

    62
  • Joined

  • Last visited

Community Reputation

139 Neutral

1 Follower

About Sword7

  • Rank
    Member

Personal Information

  • Role
    Amateur / Hobbyist
    Programmer
  • Interests
    Programming

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I removed translation from model matrix and it now rotates on its center. I put camera position (translation) into view matrix. Now model is at its origin and camera now move around it (origin). That resolved rotation problem.
  2. Yeah. Good news!! I finally resolved that object rotation problem. I moved translation to view matrix and object now rotates on its center! I can now leave RTE method unchanged. I am now working on earth rotation model. I have to fix tile culling due to rotation when I tried to bring camera to ground. prm.obj.orot = glm::rotate(mat4d_t(1.0), glm::radians(90.0), vec3d_t(0.0, 1.0, 0.0)); prm.dmModel = glm::transpose(prm.obj.orot); prm.dmView = glm::translate(prm.dmView, prm.obj.cpos); prm.mvp = mat4f_t(prm.dmProj * prm.dmView * prm.dmModel);
  3. Oh!! I got it now. I did not know that RTE method eliminates translation cause that planet rotates around camera's origin. Thanks for let me know. I will use RTW method for outside planets. I will figure them out.
  4. Oh I forget to normalize lqrot! I fixed a bug now. No more 'flat line' distortion! View frustum is always origin (0, 0, 0) and only rotation and using object positions as relative world space. That's why eliminates jitters (more accurate). I am using column vector (majoring). I am using matrix as ordering: projection * view (rotation) * translation * rotation. prm.obj.orot is object rotation prm.obj.opos is object position prm.cpos is camera position prm.crot is camera rotation
  5. I implemented rotation model for earth. It orbits around me instead it rotates on its center. Some tutorial explains ordering for model is: rotation * translation. I am figuring out but can't find solution yet. It did not work with code because it orbits around me (surface always face me around) instead of rotating its center. prm.dmProj = glm::perspective(cam->getFOV(), double(gl.getWidth()) / double(gl.getHeight()), DIST_NEAR, DIST_FAR); prm.dmView = glm::transpose(glm::toMat4(prm.crot)); // prm.obj.orot = glm::toMat4(body.getRotation(prm.now)); prm.obj.orot = glm::rotate(mat4d_t(1.0), glm::radians(90.0), vec3d_t(0.0, 1.0, 0.0)); prm.dmWorld = prm.dmView * glm::translate(glm::transpose(prm.obj.orot), prm.obj.cpos); prm.mvp = mat4f_t(prm.dmProj * prm.dmWorld); I tried to split dmWorld into dmView and dmModel but it still results the same but earth looks smaller. prm.dmProj = glm::perspective(cam->getFOV(), double(gl.getWidth()) / double(gl.getHeight()), DIST_NEAR, DIST_FAR); prm.dmView = glm::transpose(glm::toMat4(prm.crot)); // prm.obj.orot = glm::toMat4(body.getRotation(prm.now)); prm.obj.orot = glm::rotate(mat4d_t(1.0), glm::radians(90.0), vec3d_t(0.0, 1.0, 0.0)); prm.dmModel = glm::translate(glm::transpose(prm.obj.orot), prm.obj.cpos); prm.mvp = mat4f_t(prm.dmProj * prm.dmView * prm.dmModel); When I tried to rotate full 360 degrees (on Y axis) several times for flat spinning test but... Everything gradually became flat line when rotates away from earth. More spinning = more distorted like flat line effect. After more several times, it became completely horizontal flat line. I tried to rotate on its X axis and it became vertical flat line against earth on right side. I tried barrel roll several times and everything became vertical flat circle (line) on my side of me. Does anyone know any similar problem? // Free travel mode // Update current position and orientation (local reference frame) // Applying angular velocity to rotation quaternion in local space. // // dq/dt = q * w * t/2 // w = (0, x, y, z) // lqrot += lqrot * wv * (dt / 2.0f); lpos -= lqrot * tv * dt; That is my controls from keyboard for angular and travel velocity where prm.crot = lqrot and prm.cpos = lpos, wv = angular velocity and tv = travel velocity (6 DoF controls)
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!