Jump to content
  • Advertisement

TheKrane

Member
  • Content Count

    9
  • Joined

  • Last visited

Community Reputation

151 Neutral

1 Follower

About TheKrane

  • Rank
    Newbie

Recent Profile Visitors

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

  1. TheKrane

    Rotate an object around a point

    Thanks a lot Norman! I finally figured out a way to do it using glm::angleAxis and the parents forward, up and right vectors.
  2. TheKrane

    Rotate an object around a point

    OriginPosition is the position of the parent object, which is not at (0,0,0), in world space. I'm using this as my origin since I want to rotate the child object around the origin of the parent object. If I set originPosition to (0,0,0) the object rotates around the origin of the world.   I already got the child object to rotate around the parent object, the only problem is, that it's rotating around the global axis. For example: If I rotate the parent object 90 degrees on the y axis (0,1,0), the child object is facing the right direction, but it is also rotating on the global y axis (0,1,0) and not on the parent objects y axis, which differs depending on the parent objects rotation.       Now that's exactly my problem. I bascially want the child object to stick to the parent object. So all I'm doing in my logic code is rotating the parent. Now I want to rotate and position the child object accordingly.
  3. TheKrane

    Rotate an object around a point

    I explicitly set the origin position to the parent objects position. I just need to find a way to rotate the object around the local axis of the parent instead of the global axis. Any suggestions?
  4. I'm currently writing a game using OpenGL and C++. Now I want to rotate a child object around it's parent object. This is what I've got so far: glm::vec3 direction = originPosition - m_position; m_position += direction; m_rotation *= glm::quat(glm::radians(delta)); m_position -= direction * glm::inverse(glm::quat(glm::radians(delta))); I noticed that the child object is rotating on global axes. How can I rotate the child object on the local axes of the parent object?   Thanks in advance, TheKrane
  5. Thanks for the explanations guys. I used JoeJ's approach and it's working now.   It still feels like an easy hack, but it's working. I hope I won't run into similar problems later on. Thanks a lot!
  6. I'm not quite sure if I get what you're saying. Wouldn't the new X axis just be the local x axis of my object? Because using the local Up and Right vectors instead of vec3(0,1,0) and vec3(1,0,0) is not working either.   Can you explain what you mean further by using some sort of pseudo code?   Thanks in advance, TheKrane     EDIT: Changing my Rotate function to m_rotation *= glm::angleAxis(angle, glm::vec3(glm::vec4(axis,0)*glm::mat4_cast(m_rotation))); did not do the trick.
  7. I am trying to rotate an object in my game by using quaternions to avoid gimbal lock. This is my rotate function: void TransformComponent::Rotate(glm::vec3 axis, float angle) { m_rotation *= glm::angleAxis(angle, axis); } It works perfectly fine when I only rotate around a single axis. But somehow when I rotate around the x and y axis (to achieve an fps camera) the z axis rotates with the other two axes. This is how I use the Rotate function: m_pCamera->getTransform()->Rotate(glm::vec3(0,1,0), -g_pWindow->getMouseMotion().x * 0.1f * deltaTime); m_pCamera->getTransform()->Rotate(glm::vec3(1,0,0), g_pWindow->getMouseMotion().y * 0.1f * deltaTime); Does anybody know what causes this problem and how I could fix this strange behavior?   Thanks in advance, TheKrane
  8. I am currently working on an Entity-Component based, 3d Engine in C++ and OpenGL. Right now I am having problems getting the forward vector of my transform component. void TransformComponent::Update() { m_modelMatrix = glm::translate(m_position) * mat4_cast(m_rotation) * glm::scale(m_scale); } glm::vec3 TransformComponent::getForward() { const float* matrix = glm::value_ptr(m_modelMatrix); std::cout << matrix[8] << " - " << matrix[9] << " - " << matrix[10] << std::endl; return glm::vec3(matrix[8], matrix[9], matrix[10]); } I read somewhere that the 8th, 9th and 10th element of my model matrix give me the forward vector of my transform. Something is wrong with my model matrix as element 8 and 9 increase every frame and therefore give me weird results. Any suggestions on how to tackle this problem?   Thanks in advance, TheKrane
  9. TheKrane

    Bit Stumper [Android/iOS]

    Today I want to introduce our new game: Bit Stumper     Gameplay It's a puzzling and fast paced 2D Jump'n Run. The goal is to get to the exit of each level. But that's not always as easy as it sounds. You can only get there by using the so called 'Gravity Swappers'. As you probably guessed, they change the gravity. That enables you to see the Level from a different perspective and you might find a way to the exit.   Development Development of the game started on November 1st 2015. It's developed in Unity and written in C#. Paint.net and Gimp was used to create the artwork.   Release The game is going to be released on Android this month. An iOS version will be available after a successful Android launch. There's going to be two version of the game: a free version with ads in it and an ad-free premium version.   Trailer   Preview A preview version of the game is available for everybody who wants to contribute to the success of this game, whether you write an article, make a gameplay video or just want to test it to be able to give better feedback. A web-player version is also available on request.   That pretty much sums up this game. Constructive Feedback is very welcome.   best regards, Chris Krane
  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!