I think I almost got it, but I'm having trouble getting it tweaked to work...
This is a GameMaker game, and I'm playing around with the 3D features of the registered version of the programming environment. I'm trying to make a 6dof camera, and I have it working when rotated along the 'z' axis, but that's mainly because of how the camera works in GameMaker. Here's the camera prototype in GameMaker:
[font="Courier New"]d3d_set_projection(xfrom,yfrom,zfrom,xto,yto,zto,xup,yup,zup)[/font][font="Arial"]
[/font]
The camera is pretty much just a vector created from the points 'from' and 'to', and uses the 'up' vector to orient itself.
I created a rotation matrix called 'ma', and it's incremented and then orthoganilized. The code works in a different game I worked on recently, but I can't get it to work with this camera. 'ma' is a row matrix. When I do this:
[font="Courier New"]d3d_set_projection(ma11, ma12, ma13, ma21, ma22, ma23, ma31, ma32, ma33);[/font]
it works when rotating along the 'z' axis, since the camera's 'up' vector is a vector. I can't figure out how to get it to work with the 'x' and 'y' axes, since the camera uses two points to create a vector instead of using two vectors for the 'x' and 'y' axes (similar to the 'z', or the 'up', axis). Would you help me get this to work?
Thanks in advance for the help!
6DOF help
The vector from A to B is simply (B - A). So converting between two-point form and vector form is trivial
Thanks for the reply, ApochPiQ. I already tried that:
[font="Courier New"]d3d_set_projection(0, 0, 0, ma11-ma21, ma12-ma22, ma13-ma23, ma31, ma32, ma33);[/font]
and I get the same result. What it looks like is when I move left/right, the screen wipes left/right the way I expect. But when I move up/down or roll, the axis of rotation appears to be the left or right edge of the screen. It looks as if the entire axis of rotation is spun 90 degrees out of whack (y-axis rotation is from the left edge, and x-axis is from the right edge of screen). I can't figure out how to get the 'y' axis to be in front of the player, and the 'x' axis to be to the right (or left) of the player.
[font="Courier New"]d3d_set_projection(0, 0, 0, ma11-ma21, ma12-ma22, ma13-ma23, ma31, ma32, ma33);[/font]
and I get the same result. What it looks like is when I move left/right, the screen wipes left/right the way I expect. But when I move up/down or roll, the axis of rotation appears to be the left or right edge of the screen. It looks as if the entire axis of rotation is spun 90 degrees out of whack (y-axis rotation is from the left edge, and x-axis is from the right edge of screen). I can't figure out how to get the 'y' axis to be in front of the player, and the 'x' axis to be to the right (or left) of the player.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement