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.

Newcomers DBPro Corner / 3D math code needed

Author
Message
Gamer The Hut
20
Years of Service
User Offline
Joined: 15th Apr 2004
Location:
Posted: 1st Nov 2004 13:21
I need a code that will calculate the next X Y Z Position of a bullet, or any object will have after moveing a distance in a certian direction.

Given only the Speed of the object, or the distance it is going to move. And given the Xangel, Yangel, And Zangel (or in other words, the direction that the object is traveling in/looking). I need to find out the new X Y and Z coordinates after it moves that distance. Does that make sence???

I think it probably has something to do with the 2d calcualtion "C2 = A2 + B2"... But i need the 3d one

Help woul dbe great! Thanks...
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 1st Nov 2004 13:26
This might help you. http://forum.thegamecreators.com/?m=forum_view&t=37637&b=6 posted in the code snippets by Ric.

Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 2nd Nov 2004 05:57
Or just read my Vector Guide. Theres a link in the penultimate TGC newsletter.

Philip

What do you mean, bears aren't supposed to wear hats and a tie? P3.2ghz / 1 gig / GeForce FX 5900 128meg / WinXP home
Gamer The Hut
20
Years of Service
User Offline
Joined: 15th Apr 2004
Location:
Posted: 2nd Nov 2004 12:50
That Projectile code snipet iss great! and i already actaully had it, but it was TOOOO complicated for me to understand I like it, and have been tinkering with it for a while.

But all i really need is the core calcualtion for a straight movement of an object. Not a projectile altered by physics and gravity... and... head wind,, and ummm. sh*t all that complicated edgucated passed the 10th grade, think there better than me stuff. :\'(

Can anyone wip up a simple to use math formula for that kind of thing?

basicly DB already does it all for you, if you place a object in DB, point it in a certian direction, and tell it to move, it will move. but i dont want to use 'Object' commandes, i just want the math it takes to do it.

Tanks for the help tho Lost in Thought, if i dident have that codec already, it would have been awsome to have found it! Thanks alot.
Gamer The Hut
20
Years of Service
User Offline
Joined: 15th Apr 2004
Location:
Posted: 2nd Nov 2004 12:52
That Projectile code snipet iss great! and i already actaully had it, but it was TOOOO complicated for me to understand I like it, and have been tinkering with it for a while.

But all i really need is the core calcualtion for a straight movement of an object. Not a projectile altered by physics and gravity... and... head wind,, and ummm. sh*t all that complicated edgucated passed the 10th grade, think there better than me stuff. :\\\'(

Can anyone wip up a simple to use math formula for that kind of thing?

basicly DB already does it all for you, if you place a object in DB, point it in a certian direction, and tell it to move, it will move. but i dont want to use \'Object\' commandes, i just want the math it takes to do it.

Tanks for the help tho Lost in Thought, if i dident have that codec already, it would have been awsome to have found it! Thanks alot.
Gamer The Hut
20
Years of Service
User Offline
Joined: 15th Apr 2004
Location:
Posted: 2nd Nov 2004 12:53
stupid forume post cant even get this to work... what the !@#$% am i doing programming!!! lol
Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 3rd Nov 2004 06:06
Is that a rhetorical question or do you want an actual answer?

Anyway check out my Vector Guide.

Philip

What do you mean, bears aren't supposed to wear hats and a tie? P3.2ghz / 1 gig / GeForce FX 5900 128meg / WinXP home
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 3rd Nov 2004 10:05
@Philip - just started reading your vector tutorial now - nice work! (I like the humour in it, too - makes a dry subject less scary!)

@Gamer:

There are easier ways to get a bullet to move than by using 3D maths equations - commands like turn object, move object etc. are there to make your life easier.

However, if you really want to go the equation route, and what you see in Philips vector tutorial isn't your cup of tea either, anfd you were scared off by all the different variables in my projectile code, then here is some code which uses just maths equations to calculate the position of the bullet given the velocity, the direction (y angle) and the trajectory (angle from the horizontal). No gravity, air resistance, etc.

Use the arrow keys to point the gun, and space to fire. The code's pretty rough, but you could adapt it for your needs without too much trouble. It's remarked so you can see what each bit does.




Gamer The Hut
20
Years of Service
User Offline
Joined: 15th Apr 2004
Location:
Posted: 4th Nov 2004 07:51
Thanks for the code Ric, seems simple enough. And where can i find this Vector Guide? I couldent find it.
Gamer The Hut
20
Years of Service
User Offline
Joined: 15th Apr 2004
Location:
Posted: 4th Nov 2004 07:57
Oh btw, i dident watn to use the DB Object commands for moveing and pointing a bullet object cuz the way i figure it; Just using varibles to move bullets around is much more cost effecent on the CPU then useing object commands. It's also the way i like my tea, as you put it

It just made sence to me when i thought of the best way to manage tones of things flying around without takeing up too much CPU speed. All my little prorams right now do use the object commands too, but im going to start converting them to just using equations as soon and i learn how.

Thanks again Philip, Ric, and Lost in Thought.
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 4th Nov 2004 09:28
Gamer The Hut
20
Years of Service
User Offline
Joined: 15th Apr 2004
Location:
Posted: 4th Nov 2004 10:35
OK, i see the vector Guide. It's cool, and ill have fun spending some time (weeks) learning how it works... Im a slow learner But yeah it all looks fun, and thanks alot for the help.

Login to post a reply

Server time is: 2024-09-23 04:22:03
Your offset time is: 2024-09-23 04:22:03