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 / Vector help please

Author
Message
anseyder
21
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Australia
Posted: 31st May 2004 05:38
OK, I understand what a vector is = essentially a point and direction in space. But I am stymied on exactly how to use the vector commands in DBPro. I have looked at some examples but most of the ones I have seen on the forums have created their own types eg:

`set up the ship's main vector
shipv as vector
shipv.x=0
shipv.y=0

I don't fully understand how all that works and essentially I want to use the built in commands not create my own. I don't understand how to convert standard x,y,z positions in space into a vector3 and then how to use that information to apply things like movement and velocities. I have seen many posts expressing confusion on this topic and to be honest if you want to create flying games etc with realistic movement it is essential to understand how to use vectors. If someone would be kind enough to give an example of object or camera movement using the built in Vector3 commands with clear explenations I (an I am sure many others) would be eternally grateful. In the meantime I will continue learning about what vectors are. Please help me learn how to use them...cheers!
anseyder
21
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Australia
Posted: 31st May 2004 06:52
I will also add that while I have read through PJY's vector movement in the code base I still don't understand all of it. Besides which it uses the "set vector3 to camera" command and I want the ability to move an object and there is no "set vector3 to object" command...
nuclear glory
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 31st May 2004 09:11
We made some tutorials about the subject. They aren't specific to DB but should help. All the tutorials currently listed all have to do with vectors in one way or another.

http://www.nuclearglory.com/tutorials.php

Hope that helps.

Lead Programmer/Director
Powerful Collision DLL for DBPro and DBC: http://www.nuclearglory.com
Lightwave Scene Exporter to .X also at: http://www.nuclearglory.com
anseyder
21
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Australia
Posted: 31st May 2004 09:26
your tutorials are awesome - clear explenations thanks! The only thing missing is how you actually code the vector commands in DBPro, I just don't get how to get a vector3 in DBPro yet. I understand what vectors are, just not how to actually use them in code! Cheers
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 31st May 2004 10:56
I've never used those fancy math commands before either. But I read through the help file and came up with this to cover the basics. Does this help you figure out how to use them?



"eureka" - Archimedes
anseyder
21
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Australia
Posted: 31st May 2004 11:20
hey that's definitely getting there! Thanks!

I at least now know how to create a vector. Ok, the next step is being able to use the vector to drive an objects movement. eg: lets say I have a car and i want to drive along the cars local z axis (ie it's current facing - so I need to get a vector3 to determine which way it is going...?). Normally I would simply use the "move object" command. But imagine the car is on ice and I turn the wheel while just rolling along without using the gas, instead of changing direction the car would spin around it's y axis but continue to travel in the current vector3 direction. When I add the gas it would start to move gradually in the direction of its new facing...Kind of like the space ship out of asteroids if you get my drift. There has been an example of this kind of movement done but I don't understand how to create this kind of movement (with inertia) using all the vector3 commands etc without creating your own types. which as mentioned I don't want to do. I find this rather confusing so a little more help on creating this kind of movement would be great! I am working on it so I'll post something as soon as I can on where I am up to...
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 31st May 2004 12:24 Edited at: 31st May 2004 12:26
You want a unit vector for the car's direction. It's a vector where all three numbers(x,y,z) have a total distance of 1. Read NG's tutorial on normals for more info on that. And then to update your car's position, take each component of the vector and multiply it by the speed of the car. So if your car moves at 10 units per loop:




But if you want the car to straighten out gradually after turning on ice, the speed would change each loop as acceleration is applied.

"eureka" - Archimedes
Cyberflame
21
Years of Service
User Offline
Joined: 4th Sep 2003
Location: Im not sure....
Posted: 31st May 2004 14:58
http://www.pixelate.co.za/issues/5/articles/circle/sincos.htm

A very nice article.

IF your rolling along the ocean in you jet ski and the wheels fall off. Do you still have enough pancakes to cover a doghouse?

Purple, because icecream has no bones.
anseyder
21
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Australia
Posted: 1st Jun 2004 02:43
thanks all for your help - it has been much appreciated! going to try getting it all to work today!
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 1st Jun 2004 06:06
nice web article on 2d-3d projection.

"eureka" - Archimedes

Login to post a reply

Server time is: 2024-11-26 19:43:21
Your offset time is: 2024-11-26 19:43:21