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 / the strifes of strafing...

Author
Message
Darth Randal
19
Years of Service
User Offline
Joined: 19th Jan 2005
Location: ?
Posted: 19th Jan 2005 11:50
^^^^^^^^^^^^^^^^^^^^^^^ see its a play on words^^^^^^^^^^^^^^^^^^^^
hahaha.....

k so i made this simple little room and camera thing to kind of test the proverbial waters before i attempt to make this 1st person shooter (like unreal, but probably lamer) but for some reason the strafing isnt quite working right(or at all) see it there at the bottom? i took that snippet off of a forum thread, so maybe i have to initialize some arrays or something... obviously i dont know. anyways it IS the right joystick and those ARE the right buttons for it. any suggestions?
Opus
19
Years of Service
User Offline
Joined: 10th Jan 2005
Location:
Posted: 19th Jan 2005 13:01
Hello Darth. For what it's worth your code did not post. I have noticed that this happens fairly frequently in these forums. I do not know if the users are doing something wrong or if the code posting function is just buggy. I haven't tried the feature myself yet but I do know that it's best to check and see if the code posted after the fact. In any event, good luck.
Darth Randal
19
Years of Service
User Offline
Joined: 19th Jan 2005
Location: ?
Posted: 19th Jan 2005 15:06
k here it is. and this strafing isnt working. i got it off one of these formum strings(is locked now). i dunno what those arrays are, but...uh... there it is.






make matrix 2,3000,3000,30,30
make matrix 1,3000,3000,25,25
randomize matrix 1,20
randomize matrix 2,100
position matrix 2,0,200,0
position camera 250,75,0
point camera 250,0,250
hide mouse
fog on
fog distance 500
fog color rgb(0,0,0)

perform checklist for control devices
set control device checklist string$(1)

do


turn camera right (joystick x()/80)
move camera (joystick y()/-35)


if joystick fire x(7)=1
x#=x#-cos(camera angle y())
z#=z#-sin(camera angle y())
endif


if joystick fire x(6)=1
x#=x#+cos(camera angle y())
z#=z#+sin(camera angle y())
endif


sync
loop
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 19th Jan 2005 20:34


The easy way to do strafing...
Although i think using a joystick for an fps would be horrible. Give me a mouse and wasd keys anyday.


http://www.dbspot.com/NYC
New years competition... Fo Shizzle.
Darth Randal
19
Years of Service
User Offline
Joined: 19th Jan 2005
Location: ?
Posted: 20th Jan 2005 04:08
i was thinkin that (turn, move, turn camera) but that leaves me with blinks from a side view that are odd and somewhat disorienting. my plan is to end up having the camera follow an object(obviously), but that presents the same problem... how to move perpendicular to the camera angle, and yet not CHANGE the camera angle...

Also, i meant gamepad, not joystick, if that makes a difference.
The admiral
22
Years of Service
User Offline
Joined: 29th Aug 2002
Location:
Posted: 20th Jan 2005 05:32
Ummm why not just move the camera left and right??

[href]www.vapourhost.com/~flyer[/href]
Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 20th Jan 2005 06:43
i always use "newxvalue" and "newyvalue", ive never had any problem with them.

eg: to strafe the character 5 units right with starting position x#,y#,z# and a yangle of ang# then:



i think thats about it, i havnt check the code through yet, ill do that now.
Darth Randal
19
Years of Service
User Offline
Joined: 19th Jan 2005
Location: ?
Posted: 20th Jan 2005 13:55
sigh... i slipped in that code, with the arrays and stuff, i switched object angle() with camera angle(), i even make an object and applied the same rules in the main loop... but to no avail. i know the buttons are right on the gamepad... here goes what i have so far here

Before main loop (engine i guess)

make object cube 1,30
position object 1,500,20,20
perform checklist for control devices
set control device checklist string$(1)
position camera 500,75,0
set camera to object orientation 1make object cube 1,30
position object 1,500,20,20
perform checklist for control devices
set control device checklist string$(1)
position camera 500,75,0
set camera to object orientation 1

x#=object position x(1)
y#=object position y(1)
z#=object position z(1)
ang#=object angle y(1)


(the set camera to obj orientation command doesnt seem to make the camera follow the cube..)


then inside the main loop::

if joystick fire x(7)=1
x#=newxvalue(x#,(ang#+90),5)
z#=newzvalue(z#,(ang#+90),5)
endif


if joystick fire x(6)=1
x#=newxvalue(x#,(ang#+90),5)
z#=newzvalue(z#,(ang#+90),5)
endif




but something occurs to me. this code would create four arrays and store the various angles and positions, but there's nothing tying the angles,positions back to those values when modified by the main loop... does this make sense to you?

Hilarious signature to be released 02-07-04
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 20th Jan 2005 19:46
Quote: "
(the set camera to obj orientation command doesnt seem to make the camera follow the cube..)
"


Its not supposed to. It just rotates the camera to the same angles that the cube is at.

In your main loop you must have:


The variable x#,z# and ang# can't be used by any other peice of code.
That should work.


http://www.dbspot.com/NYC
New years competition... Fo Shizzle.
Darth Randal
19
Years of Service
User Offline
Joined: 19th Jan 2005
Location: ?
Posted: 21st Jan 2005 01:58
Flawless code. thanks for dropping it here.

Hilarious signature to be released 02-07-04
Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 21st Jan 2005 04:28
Yeah thanks Red_eye sorry i didnt explain it properly, that was what i meant.
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 21st Jan 2005 04:35
No worries chaps. I live to... well i live.



http://www.dbspot.com/NYC
New years competition... Fo Shizzle.
Darth Randal
19
Years of Service
User Offline
Joined: 19th Jan 2005
Location: ?
Posted: 21st Jan 2005 11:56
......i spoke too soon.
i only had a minute or so to test it out, and assumed it was flawless, but it's not quite... um.... well the strafing angles are all screwy if you're standing backwards, otherwise, it realy is flawless... i thought that the problem was that the ang# array wasnt wrapping, and then defaulting to 0 or 360 when more or less than said numbers.. i tried the wrapvalue command, but to no avial again... heres what i've got... again..


Hilarious signature to be released 02-07-04
Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 22nd Jan 2005 10:21
This is jus like i posted in the other post (just in case you still check this one) it is because you are using turn object, see your other post for the fix.
Good Luck
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 22nd Jan 2005 18:07
Change:


to:



http://www.dbspot.com/NYC
New years competition... Fo Shizzle.

Login to post a reply

Server time is: 2024-11-27 21:45:11
Your offset time is: 2024-11-27 21:45:11