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 / Sorrry forgotten how you make fps Mouelook with objects

Author
Message
vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 14th Feb 2008 12:46 Edited at: 14th Feb 2008 22:33
Sorry yes how do I keep the player on the ground while he looks around to shoot while using a model object.

I was going to turn this piece of code into a 1st Person player using objects

but I can't seem to get the object to move for some reason, what am I doing wrong?
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 14th Feb 2008 17:19
@ vampyre

Use the command get ground height(matrix number,x position,z position)
When you jump, check if the hovercraft y position(y#) is smaller than the ground height(gy#):

rem get hovercraft positions
x#=object position x(2)
y#=object position y(2)
z#=object position z(2)

rem (gravity and movement to control the hovercraft go here)

rem get ground height
gy#=get ground height(1,x#,z#)

rem position hovercraft at ground level if it hits ground
if y#<gy# then y#=gy#

rem position hovercraft with updated positions(this goes at the end of the loop)
position object 2,x#,y#,z#


With the gravity, I would have done something like this:

playergrav#=playergrav#-0.5 : rem or the gravity strength you want
y#=y#+playergrav#

rem position hovercraft at ground level if it hits ground
if y#<gy# then y#=gy# : playergrav#=0.0


And to jump, you just set the playergrav# to the height you want it to jump to when the key is pressed.

TheComet

Oooooops!!! I accidentally formated drive c.
vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 4th Mar 2008 13:51
Thank you The Comet I will work with this code thank you

Login to post a reply

Server time is: 2025-06-04 01:49:35
Your offset time is: 2025-06-04 01:49:35