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 / Need help grasping the camera codes

Author
Message
Megaman Zero
23
Years of Service
User Offline
Joined: 25th Jan 2003
Location: United States
Posted: 13th Jul 2003 11:31
Well, I cant figure out how to make camera's. I want a first person camera, but I cant figure out #1, what to put as the camera's coordinates, & #2, how do I lock the camera so the player controls the camera instead of an object, & the object is locked onto the camera?

I have tried to make my own cameras, I can make them, but they cant be controlled properly.

Thanks,
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 13th Jul 2003 12:38 Edited at: 13th Jul 2003 12:43
First things first, they are COMMANDS not codes (sorry, just minor point)

The commands are similar to those used to deal with objects.
eg: MOVE CAMERA, TURN CAMERA LEFT etc.

Cameras are created with a starting position of 0,0,0 - just like objects, matrixes and all other 3D "things" in DBP.

This should help you: This code makes a simple matrix and allows the player to move around on it. It also creates a second camera which shows the same view as the main camera.



This slightly modified code produces a hilly matrix and constantly repositions the camera at the right height



Megaman Zero
23
Years of Service
User Offline
Joined: 25th Jan 2003
Location: United States
Posted: 13th Jul 2003 23:03
Rob K... That was an amazing answere, which was very easy for me to understand. Now, one last question, is it possible to lock an object on the screen in first person view, without having to worry about seeing it from the camera, but rather seeing the gun the player is holding instead?

I want to start with a single player game, but I want to add multiplayer onto it later (which belive it or not, I understand some aspects of multiplayer coding, due to the book A Beginners Guide to Dark Basic Game Programming.) I just dont remember the book going into camera's & objects too much (or at all.)

Anyway, for all of the multiplayer guru's out there, lets say I have an object, & I want the other players to see the object as the camera of the other players, but they only view the gun and/or shield of their own character, how would this be done?

I think this is what I want in single player, & I just add multiplayer onto it later, but this part has me more baffled than the cameras right now.

At first, I just want to lock a cube onto the camera, for testing, but I want to basicaly hide the cube if in first person view, but allow everyone else to see it.

Thx,

Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 13th Jul 2003 23:48 Edited at: 13th Jul 2003 23:48
LOCK OBJECT ON ObjectNumber

Megaman Zero
23
Years of Service
User Offline
Joined: 25th Jan 2003
Location: United States
Posted: 14th Jul 2003 00:13
Thanks, I think I got it to work right, now how about strafing? How would this be done (give me the command syntax like you did above, so I can learn it (if possible,)) also, what commands would I use to go about with a mouselook. I saw all of the mouse commands in the index under m, but the ones I saw, only returned the position of the mouse. What command would I use to actually move the camera when the mouse is moved? This time, can you only give me the X movement, I want to try & move the Y on my own.

Thx,

Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 14th Jul 2003 02:10
The easiest way to do strafing is to turn the camera 90 degrees in the direction you want to strafe, move the camera forwards, and then rotate it back to where it was before moving it. Remember that what is drawn on screen is the state of everything just before the SYNC command.

Megaman Zero
23
Years of Service
User Offline
Joined: 25th Jan 2003
Location: United States
Posted: 14th Jul 2003 02:58
Ok, so by what you say, I am assuming, that you want me to write something like this...



Only problem is, I think I am doing something wrong there, as that code returns some errors. Unfortunatly, I cannot determine where the errors arise, as I am still very new to all of this, can you help me out yet again & tell me where my error lies in that code? Is that even what you are telling me to do?

Thx,

Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 14th Jul 2003 03:15
Replace all the "THEN"s apart from the first one with colons:



or better yet



MikeS
Retired Moderator
23
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 14th Jul 2003 03:22
Try this code out, It's how I do my movement in my matrix editor, so hopefully it will help you out a little bit.It's just riped right out from my editor pretty much(except I took out some of the other movement commands, so this could just show you the basics.)

Note: it covers movement, but not locking onto an object.

I hope this helps you with movement, and if you need anything more, post again.

Yellow:Wanna publish my game microsoft, cuz i no u rich so...Can I have my bag of money now?
Microsoft: *snicker* Tip of the month-Microsoft will never(probebly) publish your game.
Megaman Zero
23
Years of Service
User Offline
Joined: 25th Jan 2003
Location: United States
Posted: 14th Jul 2003 03:23
Oh, I knew it would be a newbie error like that. I finaly got it to work (Thanks,) now what about the mouse question. Can you give me the syntax for the mouselook thing (something similar to that in half life?) I will be browsing the index for the mouselook abilities, but im not sure if I can find it.

Thanks,

MikeS
Retired Moderator
23
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 14th Jul 2003 03:24
Oops, lol we posted a minute after each other.

Glad your problem is solved then.



Yellow:Wanna publish my game microsoft, cuz i no u rich so...Can I have my bag of money now?
Microsoft: *snicker* Tip of the month-Microsoft will never(probebly) publish your game.
Megaman Zero
23
Years of Service
User Offline
Joined: 25th Jan 2003
Location: United States
Posted: 14th Jul 2003 04:54
Yeah, forums are kind of lame in the fact that they cant determine if one person is replying & stop the other person from replying until the person has replied, even though this is possible, its not a good idea in its own anyway.

Anywho, now my biggest problem is trying to figure out how to use the mouse as a look tool for the camera. I know the camera commands to move the camera, but I dont know the mouse commands to do this. If I can get this, I can start programming my game a bit more trying to make a basic engine.

Megaman Zero
23
Years of Service
User Offline
Joined: 25th Jan 2003
Location: United States
Posted: 14th Jul 2003 16:13
Ok, I got a code that allows the mouse to move the camera, but I have now another problem. I have attached my entire code as a source.

My problem now, is that when I try to strafe & use the mouse at the same time, I can only do one or the other. I wish for the ability to be able to do both at the same time, but I cant figure out what to do.

Should I add more if then statements to my code, that will make it so that if a or d is held down, & the mouse is moved, it will look while strafing, or what?

Thx,

Megaman Zero
23
Years of Service
User Offline
Joined: 25th Jan 2003
Location: United States
Posted: 15th Jul 2003 23:07
Anyone? I also noticed that it has another problem, if I am looking directly up, & then I strafe (& possibly move,) the camera will snap back into viewing the front. Is there a very easy fix to my problem, or is this a hard long process?

Thx,

Coop
23
Years of Service
User Offline
Joined: 16th Jul 2003
Location:
Posted: 22nd Jul 2003 02:36
PAREMETER MISMATCH. XROTATE CAMERA EXPECTS REAL.

I am confused why this happened, I typed the code.


Coop
23
Years of Service
User Offline
Joined: 16th Jul 2003
Location:
Posted: 22nd Jul 2003 02:38
Oops sorry here ya go.

I dunno why a syntax happned...


The error said, PAREMETER MISMATCH. XROTATE CAMERA EXPECTS REAL.

It highlighted the words, xrotate camera 0,0 when it gave me the error.

Login to post a reply

Server time is: 2026-07-21 02:25:50
Your offset time is: 2026-07-21 02:25:50