Hi. I'm using DBP to get some kind of 3rd person environment up off the ground. I've got a textured matrix, a textured skysphere (which is 'tied' to the camera so that it follows the camera movement). I've also got an animated 3D character, which plays an idle animation whilst still, and a walking animation whilst moving forward, backward, turning left and right.
I then implemented the 'SET CAMERA TO FOLLOW' command, to make the camera follow the character. When I'm turning, the camera maintains the angle behind the character. When I walk forwards or backwards when the character is at angle 0 (as in, moving directly up and down the Z axis) everything's fine - the camera follows him, and it's nice and smooth as per the smoothness variable I set.
The problem is when I turn the character to a diagonal angle (or, in fact, any angle that isn't 0, 90, 180 or 270), and then move the character, the camera gets all jittery on its Y axis. I've tried all sorts of things with the code that I can think of, disabling aesthetic code like the animation, removing the skysphere etc. I've tried fudging it out by scaling everything up, and while that seems to minimalise the problem, it's still noticeable. I've reordered the code to see if that would help. I've tried my best, and I just can't shake this problem. The character moves diagonally ok, but it seems like the camera is sort of 'staircasing' between variables.
I feel like I've tried everything I can think of, and I made sure to before bothering anyone on these boards. I'm reluctantly asking for help now, please.
Here's my system specifications...
Windows XP Home Edition with SP2
3.4 ghz Pentium 4
1 gb DDR RAM
200 gb HDD
Geforce 5700 LE with 128 mb onboard memory
And my code...
PERFORM CHECKLIST FOR DISPLAY MODES
SET DISPLAY MODE 1024,768,32
sync on
sync rate 30
MAKE CAMERA 1
AUTOCAM OFF
MAKE MATRIX 1,1000,1000,100,100
LOAD IMAGE "media\temp\Environments\test_arena\floor_U3_01.bmp",1
LOAD IMAGE "MEDIA\TEMP\ENVIRONMENTS\TEST_ARENA\SKYSPHERE.PNG",2
LOAD IMAGE "MEDIA\TEMP\CHARACTERS\KNIGHT\KNIGHT.DDS",3
LOAD OBJECT "media\temp\Characters\Knight\H-Knight-Idle.X",2
PREPARE MATRIX TEXTURE 1,1,1,1
UPDATE MATRIX 1
TEXTURE OBJECT 2,3
POSITION CAMERA 1,500,5,500
POSITION OBJECT 2,500,0,510
SCALE OBJECT 2,300,300,300
MAKE OBJECT SPHERE 1,-1000
TEXTURE OBJECT 1,2
FOG ON
FOG DISTANCE 750
FOG COLOR 150,150,150
SET OBJECT SPEED 2,5
APPEND OBJECT "media\temp\Characters\Knight\H-Knight-Move.X",2,26
LOOP OBJECT 2,1,24
DO
SYNC
`PLAYERFRAMES = TOTAL OBJECT FRAMES (2)
`PRINT PLAYERFRAMES
PLAYERX = OBJECT POSITION X (2)
PLAYERY = OBJECT POSITION Y (2)
PLAYERZ = OBJECT POSITION Z (2)
PLAYERROTATE = OBJECT ANGLE Y(2)
SET CAMERA TO FOLLOW 1,PLAYERX,PLAYERY,PLAYERZ,PLAYERROTATE -180,10,5,25,1
CAMX = CAMERA POSITION X (1)
CAMZ = CAMERA POSITION Z (1)
POSITION OBJECT 1,CAMX,0,CAMZ
IF UPKEY() = 1
MOVE OBJECT 2,-0.2
ENDIF
IF DOWNKEY() = 1
MOVE OBJECT 2,0.2
ENDIF
IF LEFTKEY() = 1
TURN OBJECT LEFT 2,3
ENDIF
IF RIGHTKEY() = 1
TURN OBJECT RIGHT 2,3
ENDIF
IF UPKEY() = 1 OR DOWNKEY() = 1 OR LEFTKEY() = 1 OR RIGHTKEY() = 1
SET OBJECT SPEED 2,30
LOOP OBJECT 2,26,50
ELSE
SET OBJECT SPEED 2,5
LOOP OBJECT 2,1,24
ENDIF
LOOP
Thank you for your time.
Who wants cake? I've got a little slice of hell for everyone.