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 Discussion / I need help with a FPS...

Author
Message
Zenn
19
Years of Service
User Offline
Joined: 27th Sep 2005
Location:
Posted: 28th Sep 2005 01:06
Alright. I need an effective code to keep my gun and hand objects in the screen when you move and look with the mouse. I tried to use the lock object on command, but it made my models all funky. I posted what I have below. It has some pretty messy math equations I wrote in a few hours . It works very well when rotating around the Y axis (looking left or right with the mouse), but when I look with the X axis, (looking up or down with the mouse), It looks like it is being rolled right. It works If the camera Y angel is 0, but after that, it just keeps getting worse. Someone help my with my code, or suggest a new one please! Or if you know how to get the lock object on to not skrew up my models, that would be good too. Thanks!
SimSmall
20
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 28th Sep 2005 13:34 Edited at: 28th Sep 2005 13:36
stopping it rolling when rotating around the x axis is

set object rotation zyx <Object number>

Other than that - I don't know.. I too am having a few problem when looking up and down (the gun always stays at its current Y position, and so looking too far up or down, it vanishes from view - but really, it's just in front of you)... - but that SHOULD fix your rolling on the X axis problem...

Where to go from that... I'm afraid you'll have to figure out yourself (or very nicely ask the god, TDK_Man, to help you, there's nothing he doesn't know )

Edit: btw, your source button at the bottom of the post doesn't work, coz you're still in noobie status (needing your posts to be approved) - if what's there is significant, then put that in code /code as well...

...maybe one day I'll finish a project
devastation
19
Years of Service
User Offline
Joined: 11th Aug 2005
Location:
Posted: 28th Sep 2005 21:17
I had that problem in my fps too. You can have the gun move up one space if the x angle is say, greater than 20 and less than 160, and another unit up if it's greater than 40 and less than 120. Do the same for 200 and 340, and 220 and 320. I havent tested this, and you'll have to use if thens for the x rotation when you position it. It's what I'm using temporarily, and there's probly a better way (cue TDK man) cas it's jerky when you're lookin up and down.

I've seen a thread about making the camera follow the gun, and have the keys move the gun instead. I've never tried it, but the earlier in the projects development, the better.

I also had a crazy idea I was thinking of trying: move the gun forward on it's z axis in a 3d editor so when you look up, the gun will be closer to you but it will still be on screen. Instead of rotating the gun's x axis in the middle, it would do it right behind the gun, so you'd sort of wave it. maybe...............

Anyway, I hope this helped. Good luck on your game

verydevastating.com
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 28th Sep 2005 22:44
Hey, aren't you the guy from tek-tips???

Anyway, it's still the same advice I give. And you might want to look in the "Iced" example that came with darkbasic...

Immunity and Annihalation makes Immunihalation...
BearCDPOLD
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 29th Sep 2005 02:15
Try positioning your camera to follow a sphere (like you typically do for collision sytems) and set up the gun as a limb.


I'm going to eat you!
devastation
19
Years of Service
User Offline
Joined: 11th Aug 2005
Location:
Posted: 29th Sep 2005 02:23
I tried that with mine. It slowed it down alot

verydevastating.com
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 29th Sep 2005 06:10
I've answered this sort of question before, but what I suggested wasn't what was required, though I'm not sure why.

http://www.computechtenerife.com/sniper.rar

This is an ongoing project which has a weapon and I use Lock Object On to position it on the screen without any problem.



Maybe it's me not understanding exactly what the problem is with using the command so if anyone can explain it a bit better I'd be grateful...

TDK_Man

Me!
19
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 29th Sep 2005 13:42
if you had the object too close to the camera when you locked it then the closest polygons will get clipped, this could be what makes your gun "funky", try disableing the objects zdepth and/or setting the camera range lower to stop the clipping (disabling the zdepth is always good for a gun since it stops it pokeing through walls when you get close)



why do they say Aliens are gonna be friendly?, surely the agressive ones wipe out the peaceloving ones, so all you have left out there are crazed flesh eating interstellar monsters.
Zenn
19
Years of Service
User Offline
Joined: 27th Sep 2005
Location:
Posted: 30th Sep 2005 22:08
Thanks for all the good ideas everyone. I used the set object rotation zyx and the rolling of the gun stopped, and now it works alright. It's still a bit choppy because of it having to run throught the math, but it works fine. If someone figures out how to use the lock object on without clipping the polygons, that would be cool too. Thanks a bunch

Login to post a reply

Server time is: 2025-05-22 12:48:22
Your offset time is: 2025-05-22 12:48:22