Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rotating Camera in 3d
#1
Alright i think this is a simple question about 3d.
I created a 3d cube in witch you can move in and out of using the arrow keys to adjust x and y and + and - to adjust the z of the camera. Now what I am wondering about is how to make it apear as if you are turning the camera or rotating it in a circle so you can look at all the sides of the box.
his world has been connected...
Tied to the darkness.
Soon to be completely eclipsed.
There is so very much to learn...
You understand so little.
A meaningless effort.
One who knows nothing can understand nothing.
-Ansem Bringer of darkness and creator of the heartless
Reply
#2
You need to use the usual ways of rotation used in 2D using SIN and COS function. For example to make the cube looking like you are walking around it, you will need to do a rotation on the X and Y axis keeping Z unchanged (I assumed that Z points upwards).
fter 60 million years a civilization will search for a meteorite destroying most of the living creatures around this age...

There must be a better future for the Cheetahs!

http://rcs.fateback.com/
Reply
#3
Yep something like this
Code:
.....
.....
rz = SQR(xc ^ 2 + yc ^ 2)

a = ATN(yc / xc)
IF xc < 0 THEN a = a + 3.14

x01 = rz * COS(a + alpha)            'X rotation of the point
y01 = rz * SIN(a + alpha)           '  Y
z01 = zc 'rz1 * SIN(az)             '    Z the same

x1 = x01 * COS(Gamma) + z01 * SIN(Gamma) 'proection on the screen
y1 = y01 * SIN(beta) + z01 * COS(beta)
..........
.........
url=http://zerodivide.h15.ru/cyclone.html]Cyclone v2.5.2 GUI For QBasic 4.5/7.1[/url]
Explorer For DOS
Reply
#4
Transpose your object matrix and transform your vertices as usual.

It's that easy with matrices.
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)