RUCCUS going over that code i noticed that when the cam mode is active your constantly moving the camera back and up here i modified it so it now works like your saying:
SYNC ON:SYNC RATE 0:AUTOCAM OFF:HIDE MOUSE
`Make a player object
MAKE OBJECT SPHERE 1,30
`Make a matrix, so we can see ourselves moving around, instead of just a blue background with no sense of orientation;
MAKE MATRIX 1,1000,1000,10,10
`Initial camMode variable, setting it to 0 will result in
`first person mode, setting it to 1 results in third person mode.
camMode = 0
`Main loop
DO
`Set the mode to the number pressed (press 1 for first person, 2 for third
IF KEYSTATE() = 0 OR KEYSTATE() = 1
camMode = KEYSTATE()
ENDIF
`Move the player object
MOVE OBJECT 1, (UPKEY()-DOWNKEY())*.5
`Turn the player object
TURN OBJECT LEFT 1, (LEFTKEY() - RIGHTKEY()) *.5
`Store the player's position and angle;
x# = OBJECT POSITION X(1)
y# = OBJECT POSITION Y(1)
z# = OBJECT POSITION Z(1)
xa# = OBJECT ANGLE X(1)
ya# = OBJECT ANGLE Y(1)
za# = OBJECT ANGLE Z(1)
`Camera code;
`Main cam code (this code would be used with both first person
`and third person, so theres no point in writing it twice, put
`it outside of the if structure;
POSITION CAMERA x#,y#,z#
ROTATE CAMERA xa#,ya#,za#
`If camMode is 1 (third person)
IF camMode
POSITION CAMERA newxvalue(x#,ya#,-60),Y#+10,newxvalue(z,ya#,-60)
ENDIF
`Refresh screen
SYNC
LOOP
also ruccus the person was asking how to get it to switch between the 2 modes
so those i noticed that M4v3r1ck you use camera1 and camera 2 so those try adding this into your code:
do
`First person camera controls
if camera1 = 1
`code
endif
`Third person camera controls
if camera1 = 2
`code
endif
`Check if v is pressed
if keystate(47) = 0 and v_pressed# = 1
v_pressed# = 0
endif
if keystate(47) = 1 and v_pressed# = 0
v_pressed# = 1
if camera1 = 1
camera1 = 2
else
camera1 = 1
endif
endif
also modify you second if statement from camera2 = 1 to camera1 = 2
as that may be another of your problems so in all it should look something like this:
`***************************Camera 1 controls
do
if Camera1=1
position camera object position x(1),object position y(1),object position z(1)
`Mouse Camera Movement
Camy#=Camy#+MOUSEMOVEX()*.1
Camx#=Camx#+MOUSEMOVEY()*.1
IF Camx#>90 AND Camx#<135 THEN Camx#=90
IF Camx#>270 AND Camx#<225 THEN Camx#=90
YROTATE CAMERA Camy#
XROTATE CAMERA Camx#
YROTATE OBJECT 1,Camy#
XROTATE OBJECT 1,Camx#
`Movement Controls
IF KEYSTATE(17)=1
XAngle#=OBJECT ANGLE X(1)
XROTATE OBJECT 1,0
MOVE OBJECT 1,.5
XROTATE OBJECT 1,XAngle#
ENDIF
IF KEYSTATE(31)=1
XAngle#=OBJECT ANGLE X(1)
XROTATE OBJECT 1,0
MOVE OBJECT 1,-.5
XROTATE OBJECT 1,XAngle#
ENDIF
IF KEYSTATE(30)=1 THEN MOVE OBJECT LEFT 1,.3
IF KEYSTATE(32)=1 THEN MOVE OBJECT RIGHT 1,.3
`Add a target reticule to the screen
CIRCLE ScreenWidth#/2,ScreenHeight#/2,2
if keystate(118)=3
camera1=0:camera2=1
endif
endif
`***********************If Camera 2
if Camera1=2
position camera object position x(1),object position y(1)+50,object position z(1)-500
`Mouse Camera Movement
Camy#=Camy#+MOUSEMOVEX()*.1
Camx#=Camx#+MOUSEMOVEY()*.1
IF Camx#>90 AND Camx#<135 THEN Camx#=90
IF Camx#>270 AND Camx#<225 THEN Camx#=90
YROTATE CAMERA Camy#
XROTATE CAMERA Camx#
YROTATE OBJECT 1,Camy#
XROTATE OBJECT 1,Camx#
`Movement Controls
IF KEYSTATE(17)=1
XAngle#=OBJECT ANGLE X(1)
XROTATE OBJECT 1,0
MOVE OBJECT 1,.5
XROTATE OBJECT 1,XAngle#
ENDIF
IF KEYSTATE(31)=1
XAngle#=OBJECT ANGLE X(1)
XROTATE OBJECT 1,0
MOVE OBJECT 1,-.5
XROTATE OBJECT 1,XAngle#
ENDIF
IF KEYSTATE(30)=1 THEN MOVE OBJECT LEFT 1,.3
IF KEYSTATE(32)=1 THEN MOVE OBJECT RIGHT 1,.3
`Add a target reticule to the screen
CIRCLE ScreenWidth#/2,ScreenHeight#/2,2
if keystate(118)=3
camera1=1:camera2=0
endif
endif
if keystate(47) = 0 and v_pressed# = 1
v_pressed# = 0
endif
if keystate(47) = 1 and v_pressed# = 0
v_pressed# = 1
if camera1 = 1
camera1 = 2
else
camera1 = 1
endif
endif
loop
also i have dbc so don't blame me if some of these commands are right or not
my smiles love me =-)=-)=-)(-=(-=(-=