# Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

### DarkBASIC Professional Discussion / math help

Message
Posted: 10th Sep 2002 16:57
Well I trying to figure out the following.
Object is at x1, y1,z1 and object 2 is at x2, y2,z2.How do I figure what angle object 1 is to object 2 for puposes such as object 1 needs move toward object 2.
Posted: 10th Sep 2002 17:56 Edited at: 16th Nov 2004 00:36
Look into SIN COS and TAN!
Posted: 10th Sep 2002 17:59 Edited at: 16th Nov 2004 00:41
It also sometimes helps to plot these things out on paper and manually work them out (with a calculator.. lol..) and then apply that to the code.

I do not have any code on hand, but this will be somewhat complicated by the fact that you're working in a 3D space. If it were 2D then you could ignore the Z1 and Z2 co-ordinates....

:: Specs: AMD Athlon XP 1600+ (1.4GHz), 512MB PC133 SDRAM, Leadtek Geforce 2MX SH 64MB, SB-Live!, LG SWrks 775N 17", MS Natural Pro KB, MS Optical Mouse, Windows XP Pro (SP1), DirectX 9.0b ::
Posted: 10th Sep 2002 19:49 Edited at: 16th Nov 2004 00:41
Would be good if someone had a function to calculate the angle between 2 3D objects!

Logo design by Indi
Its better than a poke in the eye...
Posted: 10th Sep 2002 21:11
There's more than 1 angle between 2 3D objects. You need to work with 2 of the 3 possible axis. That's why db has lots of commands to help you out. It's very complex.

Machine: P4 2200, 512MB, GeForce4 64MB, Audigy Platinum

There's a junglist inside every coder. http://www.kontact-kru.com for my own personal breakbeat terrorism.
Posted: 11th Sep 2002 04:36
I wouldn't necessarily agree that it's very complex. It would just require a bit of thinking and planning prior to coding, that's all.

:: Specs: AMD Athlon XP 1600+ (1.4GHz), 256MB PC133 SDRAM, Leadtek Geforce 2MX SH 64MB, SB-Live!, LG Studioworks 775N 17", MS Natural Pro KB, MS Optical Mouse, Windows 2000 Pro (SP3) ::
Posted: 11th Sep 2002 05:11
Ok "very complex" is open to interpretation. I'm sure I could figure it out on paper, but for me the act of actually having to get a piece of paper out and write stuff down means the task is very complex.

"Complexity" is directly proportional to "need to scribble on paper". It's a known fact.

Machine: P4 2200, 512MB, GeForce4 64MB, Audigy Platinum

There's a junglist inside every coder. http://www.kontact-kru.com for my own personal breakbeat terrorism.
Posted: 11th Sep 2002 22:06
This may help ya

http://216.239.37.100/search?q=cache:BMPflXdRb4sC:www.geocities.com/SiliconValley/Pines/6131/polysurf.html+calculate+angles+3d+game+two+objects&hl=en&ie=UTF-8

In theory, there is no difference between theory and practice. But in practice, there is.
Posted: 11th Sep 2002 22:09