Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Realy need help with 3D rotation...
#1
Hi!
Well I read the 3D tutorial and I only understand how to zoom line etc... But I don't understand the 3D rotation!!! Can you please show me an example code that is as much simple as posible without any data 1,1,1,1 stuff that will rotate one line? I know that I ask too much, but I realy need to understand it. I wan't to make simple 3D game soo much!!! Please! I realy don't get the rotation! Please help me!!! Thank you!!! Cry
Reply
#2
Quote:Hi!
Well I read the 3D tutorial and I only understand how to zoom line etc... But I don't understand the 3D rotation!!! Can you please show me an example code that is as much simple as posible without any data 1,1,1,1 stuff that will rotate one line? I know that I ask too much, but I realy need to understand it. I wan't to make simple 3D game soo much!!! Please! I realy don't get the rotation! Please help me!!! Thank you!!! Cry

One way is to be calm and patient. The knowledge you seek will come in time.

I just copy code for rotations out of books. I think I understand them :???:
I made alot of 3D programs long ago without knowing this stuff. You just need to know what they do, and you can working on understanding them later while you use them. Smile
Reply
#3
Yosuke, do you have a solid understanding of trigonomoetry? This will help greatly in doing rotations.
Reply
#4
Quote:Yosuke, do you have a solid understanding of trigonomoetry? This will help greatly in doing rotations.
I dont think so! Sad
I found an example how to rotate pixel, but its very hard to understand how pixel is rotating, and I can't find it anymore!!! I need a rotating line, then I can read the source and figure out everything how it works!! Can you please help me! I don't have much time, I am very busy! Can you please give me an example source!!? Thats all I am asking!! Please!!!
Reply
#5
To write 3D rotation programs, it is important that you first understand basic trig and then 2D rotations. I'd start there.

Here's a bit of code I wrote which I lifted off the programming help forum and edited a bit. It spins one circle around the center of the screen.

Code:
SCREEN 12                'graphics mode: 640x480
CLS                      'clear the screen

radius.center% = 100     'how far from the center the circle spins

DO

'cycle through the 360 degrees of angles
FOR degree.angle% = 0 TO 359

     'convert angle from degrees to radians
     radian.angle! = degree.angle% * (3.14159# / 180)

     'calculate coordinates of circle
     circle.x% = 320 + radius.center% * SIN(radian.angle!)
     circle.y% = 240 - radius.center% * COS(radian.angle!)

     'draw the circle
     CIRCLE (circle.x%, circle.y%), 10, 15

     'pause a moment
     FOR t& = 1 TO 10000: NEXT t&

     'erase the circle
     CIRCLE (circle.x%, circle.y%), 10, 0

NEXT degree.angle%

'quit program when a key is hit
LOOP UNTIL INKEY$ <> ""

SYSTEM

similarly, you can draw a circle using points:

Code:
SCREEN 12                'graphics mode: 640x480
CLS                      'clear the screen

radius.center% = 100     'radius of the circle

'cycle through the 360 degrees of angles.  360 degrees = a full circle.
FOR degree.angle! = 0 TO 359 STEP .05

     'convert angle from degrees to radians.  why?
     'because SIN() and COS() only accept angles in radians
     'note: 2*pi radians = 360 degrees, so ratio is pi/180

     radian.angle! = degree.angle! * (3.14159# / 180)

     'calculate coordinates of the point
     'note: (320, 240) is the center of the screen
     'y value get subtracted because we're used to larger y values being
     'at the top of an X-Y graph.  but on the screen, larger y values are at
     'the bottom of the screen.

     point.x% = 320 + radius.center% * SIN(radian.angle!)
     point.y% = 240 - radius.center% * COS(radian.angle!)

     'draw the point (white)
     PSET (point.x%, point.y%), 15

NEXT degree.angle!

SYSTEM

There, the comments in that one are better.

*peace*

Meg.
Reply
#6
Thank you very much!!! I will try that out!!! Thank you!!! Smile
Reply
#7
It looks like 2D rotation! As far as I know 3D rotation has x,y,z and xrotated, yrotated, zrotated. Can you please give me a example how to 3D rotate a line!!! Thank you!
Reply
#8
if you go to the main page of this site, you'll see some articles written by RelSoft. he's pretty much explained what you want there and in great detail. check it! Big Grin
Reply
#9
Woohoo!!!
About 2 hours I try'd to understand how it works and now I do!!! Thank you!
Reply
#10
Thats cool! Well done man. Rel's done some pretty amazing stuff in QB! Those tuts are kickass.

PS Rel, im thinking of doing some more qb stuff (with RelLib of course :lol: ), i think i saw the latest ver of the lib was in like 5 point something! Iv only got 3.6!! When i get some more time online i check out your site though.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)