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 / Top down view on a matrix,

Author
Message
The Amazing O
20
Years of Service
User Offline
Joined: 21st Aug 2004
Location: South Lopham, Diss
Posted: 18th Sep 2005 20:24
Sorry if its annoying that I keep asking for people to do mini tutorials, but its the easyest way for me to learn how to use this lovely programming language.
Could anyone show me some code that will make a matrix, that the camera is looking down on, I have given it ago myself but only got a black screen

If you want to see my code then I shall post it, but it im guessing it awful and full of obvious mistakes.

"Do not throw rocks at this sign"
THE most useless sign ever..
Leeorg
19
Years of Service
User Offline
Joined: 5th Jul 2005
Location:
Posted: 18th Sep 2005 20:52
There should be a matrix tutorial in your help file
Darkbasic MADPSP
19
Years of Service
User Offline
Joined: 15th Jun 2005
Location: Uk
Posted: 18th Sep 2005 20:54
do a matrix and then rotate the camera 90 degrees up and move the camera from that view

New game about to be unleashed steal un theif
The Amazing O
20
Years of Service
User Offline
Joined: 21st Aug 2004
Location: South Lopham, Diss
Posted: 18th Sep 2005 21:08
*finds the help files*

ahhh, cheers, should have this sussed by tonight,
Big Man
19
Years of Service
User Offline
Joined: 4th Feb 2005
Location: BEHIND YOU!!!! (but I live in England)
Posted: 18th Sep 2005 22:22 Edited at: 18th Sep 2005 22:23
The code to use is this


I hope it helps

Our aim is to keep the loo's clean, your aim can help.
Darkbasic MADPSP
19
Years of Service
User Offline
Joined: 15th Jun 2005
Location: Uk
Posted: 18th Sep 2005 22:38
bigman try this



New game about to be unleashed steal un theif
The Amazing O
20
Years of Service
User Offline
Joined: 21st Aug 2004
Location: South Lopham, Diss
Posted: 18th Sep 2005 22:46
Ah thanks, I guess to add a texture i would just use Load image "texture1".bmp,1 then use the texture number for the prepare matrix texture command.
Big Man
19
Years of Service
User Offline
Joined: 4th Feb 2005
Location: BEHIND YOU!!!! (but I live in England)
Posted: 18th Sep 2005 22:56 Edited at: 18th Sep 2005 22:59
@Darkbasic Mad
There isn't much difference in changing the make matrix 1,1000,1000,20,20 to make matrix 1,1000,1000,100,100
not when I am just trying to explain something anyway.
And you dont need a texture that was for explaining purposes but eventually you will do.

Our aim is to keep the loo's clean, your aim can help.
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 19th Sep 2005 16:55
If anyone wants a detailed explanation of using matrices, check out the Matrix Tutorial at:

http://www.computechtenerife.com/DB/tutorials.htm

TDK_Man

Big Man
19
Years of Service
User Offline
Joined: 4th Feb 2005
Location: BEHIND YOU!!!! (but I live in England)
Posted: 20th Sep 2005 16:48
Tdk i am suprised that you are not a Mod yet you always seem ready, able and willing to give help and advice.
Well done man.

BM

Our aim is to keep the loo's clean, your aim can help.
The Amazing O
20
Years of Service
User Offline
Joined: 21st Aug 2004
Location: South Lopham, Diss
Posted: 20th Sep 2005 18:14
For my next plea:
I would now like to be able to get a cube on the screen (which i can already do), but to be able to make the cube move so if you press up key then the cube moves up and the same with left, right and down.
If possible, also some code that makes the camera follow the cube whilst I move it around with the keys.
I understand of anyones getting a bit cheesed of with me keep asking for people to do stuff for me, but its the best way I have found so far to learn
Big Man
19
Years of Service
User Offline
Joined: 4th Feb 2005
Location: BEHIND YOU!!!! (but I live in England)
Posted: 20th Sep 2005 18:52
To make the cube move the code should look like this.(assuming the object number for the cube=1)

add the code into your main loop
Hope it helps.

Our aim is to keep the loo's clean, your aim can help.
The Amazing O
20
Years of Service
User Offline
Joined: 21st Aug 2004
Location: South Lopham, Diss
Posted: 20th Sep 2005 18:58
Wow, cheers, that looks easier than I thought it would be, has helped loads, thanks again.
Big Man
19
Years of Service
User Offline
Joined: 4th Feb 2005
Location: BEHIND YOU!!!! (but I live in England)
Posted: 20th Sep 2005 20:20
Always ready and willing to help.
Ask if you need any more help I will try my best to answer your questions.

Our aim is to keep the loo's clean, your aim can help.
The Amazing O
20
Years of Service
User Offline
Joined: 21st Aug 2004
Location: South Lopham, Diss
Posted: 20th Sep 2005 20:50 Edited at: 20th Sep 2005 20:51
heh cool, ok then could you give me some code that makes the camera follow the cube, I did have somthing like this-
If Upkey()=1 then position camera 500,200,500+10
If downkey()=1 then position camera 500,200,500-10

That was all in a loop (DO LOOP), with the other controls you gave me, but all that does is make the camera move up 10 when I first hit the upkey (or vice versa with the down key) and not move anymore.

Please and thankyou

By the way, I am hoping to build this up so eventually the cube becomes a car, with the camera following it, and maybe even make a BSP world with collision to drive it around in. Just as a project so I can get to grips with some aspects of using BASIC. (thought i would try something different to pong)
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 20th Sep 2005 21:22 Edited at: 20th Sep 2005 21:26
The Amazing O:

DB already has a command to do this without you having to do any coding. Check out the Set Camera To Follow Command!

Big Man:

There are enough excellent mods on here already without any more sticking their oars in!

Besides, I was a mod many years ago on the original DB forums, so I've done my stint...

TDK_Man

Big Man
19
Years of Service
User Offline
Joined: 4th Feb 2005
Location: BEHIND YOU!!!! (but I live in England)
Posted: 21st Sep 2005 16:39
Ok I just thought I might try and help out a bit but if that is how you feel I'll keave it to the mods.

@ Amazing O Tdk is right use the function already built into Dark basic.

BM

Our aim is to keep the loo's clean, your aim can help.
The Amazing O
20
Years of Service
User Offline
Joined: 21st Aug 2004
Location: South Lopham, Diss
Posted: 22nd Sep 2005 18:41 Edited at: 22nd Sep 2005 18:48
I have found the "Set camera to follow" command in DBPro, but alas, I am not to sure how to use it.

Heres what I have at the moment:

Set camera to follow X(x-co-ordinate of object), Y(y-co-ordinate of object), Z(z-co-ordinate of object), Angle (??), distance (the distance the camera is away from the object?), Heigt (how high the camera is), Smooth (smoothness of camera movement-1.0 to 100.0), collision (?? havent a clue)

So assuming my object was at the co-ordinates 500,0,500 I would have

Set camera to follow 500,0,500,?,200,200,25.0,?

Could someone please explain how to use this for me.

PS-I looked at the showcase example in DBPro's help section, but still do not understand

And heres my code incase its needed.
Big Man
19
Years of Service
User Offline
Joined: 4th Feb 2005
Location: BEHIND YOU!!!! (but I live in England)
Posted: 22nd Sep 2005 18:51 Edited at: 22nd Sep 2005 18:52
I will look it up for you

Our aim is to keep the loo's clean, your aim can help.
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 23rd Sep 2005 02:14
Set camera to follow:

X(x-co-ordinate of object) - Correct
Y(y-co-ordinate of object) - Correct
Z(z-co-ordinate of object) - Correct

Angle (??) - The angle of the object you are following that you want to position the camera. Eg: To follow behind the object, use 180.

Distance (the distance the camera is away from the object?) - Correct

Height (how high the camera is) - Correct

Smooth (smoothness of camera movement-1.0 to 100.0) - Correct

Collision (?? havent a clue) - When set to 1 stops the camera going 'inside' other objects on the landscape that have collision turned on for them.

TDK_Man

Big Man
19
Years of Service
User Offline
Joined: 4th Feb 2005
Location: BEHIND YOU!!!! (but I live in England)
Posted: 23rd Sep 2005 17:21 Edited at: 23rd Sep 2005 17:22
Rats you beat me to it I was gonna say that


Our aim is to keep the loo's clean, your aim can help.
The Amazing O
20
Years of Service
User Offline
Joined: 21st Aug 2004
Location: South Lopham, Diss
Posted: 23rd Sep 2005 18:08 Edited at: 23rd Sep 2005 18:21
Cheers for that,any recomended heights and distances to get the camera just behind the object?

I have just tried out the code, and I guess I have done something wrong or put somthing silly in it....but the camera now moves behind the ball, but does not follow it.

Here is my code:


I am right in thinking this command should be put inside the main loop?

Thanks for any help
Big Man
19
Years of Service
User Offline
Joined: 4th Feb 2005
Location: BEHIND YOU!!!! (but I live in England)
Posted: 23rd Sep 2005 19:08
try doing something like this

Where posx through z are the object position

*not fully tested
give it a try any way and tell me what happens

Our aim is to keep the loo's clean, your aim can help.
The Amazing O
20
Years of Service
User Offline
Joined: 21st Aug 2004
Location: South Lopham, Diss
Posted: 23rd Sep 2005 19:20
Hehe, doesnt matter, I changed the position of x,y and z into variables then put them into the main loop and it works perfectly, thanks anyways though
Big Man
19
Years of Service
User Offline
Joined: 4th Feb 2005
Location: BEHIND YOU!!!! (but I live in England)
Posted: 23rd Sep 2005 19:44 Edited at: 23rd Sep 2005 19:48
Well done
I hope whatever your project is goes well.
Need anymore help I'm sure everyone here would be more than happy to help

Our aim is to keep the loo's clean, your aim can help.
The Amazing O
20
Years of Service
User Offline
Joined: 21st Aug 2004
Location: South Lopham, Diss
Posted: 27th Sep 2005 18:17 Edited at: 27th Sep 2005 18:19
Me again ,
I have this code so far -


What I would like to be able to do is control where the ball moves (left or right) with the mouse. So when the mouse is moved left, the sphere will move left and vice versa with right.
Also if there are any better ways of doing the small bit of collision I have attempted or anything I could do to improve the code.

Thanks in advanced.

Login to post a reply

Server time is: 2024-09-24 05:18:41
Your offset time is: 2024-09-24 05:18:41