matrix rotation.

new topic     » topic index » view thread      » older message » newer message

Hi, can anyone help me out with some 3d rotation?
I've got a direction vector {x,y,z} for a 1st person perspective thing,
and i need to be able to rotate it around th 3 axis.
i can use the following to make it turn left/right:

new_direction[x] = direction[x] * sin(angle) + direction[z] * cos(angle)
new_direction[z] = direction[z] * sin(angle) - direction[x] * cos(angle)

That works fine, but from past experience, that method causes incorrect
rotation when you apply it 3 times, one for each axis of rotation.
I've read that matrix rotation produced correct results, but I'm not sure
how to do it. Can anyone help? The 3d engine that I've created should
alow you to point the camera in any position, any angle. It can't do objects
yet tho, it only allows a flat grid mapped ground and a textured 2 layer
moving cloud sky. It also has fog. I'm currently working on speeding it up
so it will beable to run real-time. at the moment it takes 35 minutes
on a 486 to generate 45 frames. when i add the speedup to it it should
run at about 2 frames per second, and it's still in pure euphoria code.
assembly code can speed it up even more.

Thanks for any help!
     Mark.

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu