debug draw out of sync with render mesh

Post Reply
whitwhoa
Posts: 17
Joined: Tue Jun 11, 2019 7:30 pm

debug draw out of sync with render mesh

Post by whitwhoa »

Is there a setting that I am overlooking that determines how frequently the debug lines are drawn by the debug drawer? I have a cube shape rigid body that is updating the translation and rotation of a cube object to be rendered, but when I enable my debug drawer the lines appear to not be updating at the same rate as the actual rotation of the rigid body. When the objects start falling and end falling, the wireframe always lines up with the render box, which is why I'm thinking it might be an issue related to the aforementioned...? Going to continue to look through things, might wind up figuring this out myself, if I do, I will post my findings. Thanks!

UPDATE
This has been corrected, the issue was a trivial mistake on my part. My render objects use glm for transforms, and I had simply forgotten that glm places the quaternion W component as the first parameter in it's constructor as opposed to the last. Second time this has gotten me. Maybe now I'll remember!
Last edited by whitwhoa on Sat May 23, 2020 4:24 pm, edited 2 times in total.
whitwhoa
Posts: 17
Joined: Tue Jun 11, 2019 7:30 pm

Re: debug draw accuracy

Post by whitwhoa »

For clarification I have uploaded a video which shows what I am trying to explain. It maybe an issue with how I'm applying the rotation to my model???

Video Link: https://youtu.be/2TegYEq812g

I'm basically just copying the world transform every tick like such:

Code: Select all

glm::vec3 bodyTranslation = glm::vec3(cubeBody->getWorldTransform().getOrigin().getX(),
	cubeBody->getWorldTransform().getOrigin().getY(),
	cubeBody->getWorldTransform().getOrigin().getZ());

glm::quat bodyRotation = glm::quat(cubeBody->getWorldTransform().getRotation().getX(),
	cubeBody->getWorldTransform().getRotation().getY(),
	cubeBody->getWorldTransform().getRotation().getZ(),
	cubeBody->getWorldTransform().getRotation().getW());

this->cube100->getTransform().setTranslation(bodyTranslation);
this->cube100->getTransform().setRotation(bodyRotation);
Post Reply