Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translating after rotating gives wrong orientation to objects. #7

Open
parmandorc opened this issue Nov 10, 2016 · 0 comments
Open

Comments

@parmandorc
Copy link
Contributor

The following code draws the axis twice - the second time after rotating 30 degrees on the Y axis, and then translating along the (local) X axis.

mat4t mat;
mat.loadIdentity();
app_scene->add_shape(mat, new mesh_box(vec3(5.0f, 0.1f, 0.1f)), red, false);
app_scene->add_shape(mat, new mesh_box(vec3(0.1f, 5.0f, 0.1f)), green, false);
app_scene->add_shape(mat, new mesh_box(vec3(0.1f, 0.1f, 5.0f)), blue, false);

mat.rotateY(30);
mat.translate(1, 0, 0);
app_scene->add_shape(mat, new mesh_box(vec3(2.0f, 0.1f, 0.1f)), red, false);
app_scene->add_shape(mat, new mesh_box(vec3(0.1f, 2.0f, 0.1f)), green, false);
app_scene->add_shape(mat, new mesh_box(vec3(0.1f, 0.1f, 2.0f)), blue, false);

It looks like this:
wrong

When it should look like this:
right

The position of the object is correct, but its orientation is as if the rotation had been in the opposite direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant