Removing roll from camera matrix

I have a camera class which is just this:
import org.joml.*;

public class Camera {
public Matrix4f viewMatrix = new Matrix4f().setTranslation(new Vector3f(100, 200, 100));

public void rotate(float x, float y) {
viewMatrix.rotateXYZ(x, y, 0);
}
public void move(float x, float y, float z) {
viewMatrix.translate(x, y, z);
}
}
import org.joml.*;

public class Camera {
public Matrix4f viewMatrix = new Matrix4f().setTranslation(new Vector3f(100, 200, 100));

public void rotate(float x, float y) {
viewMatrix.rotateXYZ(x, y, 0);
}
public void move(float x, float y, float z) {
viewMatrix.translate(x, y, z);
}
}
and it works, but I want to eliminate the roll from the matrix somehow.
14 Replies
JavaBot
JavaBotā€¢2w ago
āŒ› This post has been reserved for your question.
Hey @š“pothicon! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
š“pothicon
š“pothiconOPā€¢2w ago
(roll as in the tilting of the camera from left to right as shown here)
No description
JavaBot
JavaBotā€¢2w ago
šŸ’¤ Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
š“pothicon
š“pothiconOPā€¢2w ago
. /reopen
JavaBot
JavaBotā€¢2w ago
šŸ’¤ Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
š“pothicon
š“pothiconOPā€¢2w ago
open seasame
JavaBot
JavaBotā€¢2w ago
šŸ’¤ Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Noah | Nowipi
Noah | Nowipiā€¢2w ago
Then don't rotate it Does the default constructor of Matrix4f return an identity matrix?
š“pothicon
š“pothiconOPā€¢2w ago
Yes (but not sure why that matters) but i need to rotate the matrix so that i can well.. rotate the camera around, just need to somehow eliminate the roll aspect immediately afterwards
Noah | Nowipi
Noah | Nowipiā€¢2w ago
I don't understand Just don't rotate on the roll axis
š“pothicon
š“pothiconOPā€¢2w ago
what do you do to not rotate on the roll axis tho ive tried everything i can think of
viewMatrix.rotateXYZ(x, y, 0);
viewMatrix.rotateXYZ(x, y, 0);
its not like their seperate numbers im getting three axis of rotation just by rotating x and y
JavaBot
JavaBotā€¢2w ago
šŸ’¤ Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
š“pothicon
š“pothiconOPā€¢2w ago
.
JavaBot
JavaBotā€¢2w ago
šŸ’¤ Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Want results from more Discord servers?
Add your server