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 / I can´t lock my gun to the screen. HELP!

Author
Message
Freddy 007
19
Years of Service
User Offline
Joined: 30th Nov 2004
Location: Denmark
Posted: 1st Feb 2005 20:43 Edited at: 1st Feb 2005 21:08
Hi

I´ve just started modelling a bit, and I´ve made a Colt that I would like to have in my game.

So far i have this code:



But when I run the game, I can´t see my gun!
I´ve tried to run the game WITHOUT the lock object on, and then my gun is in the middle of the screen
But I want to lock my gun in that position.

Please, help me!

Thanks

[EDIT] Oh, I forgot... I´m using Dark BASIC Professional


Check out PanzerGames at http://www.freewebs.com/panzergames
Foxy
19
Years of Service
User Offline
Joined: 4th Jan 2005
Location: The Dale, South Australia
Posted: 1st Feb 2005 20:53 Edited at: 1st Feb 2005 21:00
Try locking the object to screen before your main loop, bundled with your loading gun code. Although that probably wont work it might have to do with the 0,0,0 position of your object. Load the gun into your modelling program and if it does not appear right in the centre of the axis then the 0,0,0 pos of your object is offset.

Just noticed this then: when your positioning your gun you're setting it off to the side a fair bit, try moving the gun forward a bit.

If any of those don't work, you've got me stumped.

Anyway, good luck.

[edit] Yeah, youre prob is most likely going to be locking the object to screen before moving the camera or anything else. You're moving the cam first so the gun is going to be locked with that cam position in relation to itself. Anyway, I babble on...

If I were you and you were me, then you'd be yourself 'cos you are me and I am you.
Freddy 007
19
Years of Service
User Offline
Joined: 30th Nov 2004
Location: Denmark
Posted: 1st Feb 2005 21:01
It doesn´t work

I´ve set the position offset to 0,0,0

I´ve put the lock object on together with the loading code

And I have no idea of what´s wrong
I need help


Check out PanzerGames at http://www.freewebs.com/panzergames
Dodo
20
Years of Service
User Offline
Joined: 8th Aug 2004
Location: eating lunch
Posted: 2nd Feb 2005 03:18
well perhaps you might consider placing the gun every loop, all lock object on does is to re-orientate the axis, so it will move forward when you use the move object command. Try using the camera position commands to position the gun object each loop.

Part of solving the problem is actually noticing that the problem is there in the first place

Freddy 007
19
Years of Service
User Offline
Joined: 30th Nov 2004
Location: Denmark
Posted: 2nd Feb 2005 03:30
Then how do I make it so, that when i rotate the camera, the gun rotates too, and it stays in sight, so it never disappears or appear in a strange angle?


Check out PanzerGames at http://www.freewebs.com/panzergames
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 2nd Feb 2005 09:14 Edited at: 2nd Feb 2005 09:18
This may help - just wrote it in answer to a different thread....



Oh, and by the way, when you lock an object, you only need to do it once - before your main program loop, and before you position the camera away from 0,0,0.


Freddy 007
19
Years of Service
User Offline
Joined: 30th Nov 2004
Location: Denmark
Posted: 2nd Feb 2005 21:52 Edited at: 2nd Feb 2005 22:22
Thanks, but I just got it to work myself.
I have no idea what I did, but this code is working:



Thanks


[EDIT] But I have another problem now though...

I am trying to make a bullet that will fire if mouseclick=1.

It looks like:

if mouseclick()=1

position object bulletnumber#,bulletposx#,bulletposy#,bulletposz#
rotate object bulletnumber#, 0-camera angle x(),0-camera angle y(),0-camera angle z()
fire#=1
bulletlife#=100
show object bulletnumber#
endif

and so on...
It actually works great... But if I move the camera, it´s like the program doesn´t update the camera position, and positions the bullet in the cameras original position...

[EDIT EDIT ] I solved the problem myself.... sorry

I told the program that bulletposx/y/z=camera position x/y/z OUTSIDE the loop, so it WASN`T updating tho coordinates....


Check out PanzerGames at http://www.freewebs.com/panzergames

Login to post a reply

Server time is: 2024-09-23 10:18:51
Your offset time is: 2024-09-23 10:18:51