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 / I can't place my 3rd person perspective object in centre of matrix DBC

Author
Message
crowcity
19
Years of Service
User Offline
Joined: 2nd Jan 2005
Location: East of England
Posted: 6th Jan 2005 06:57
Having just experienced the unspeakable joy, after many hours, of creating a 3rd person perspective dinosaur(directx object) that runs around an undulating matrix with perfect camera following (I'm new to DB), I'm completely stuck on placing it anywhere but at 0,y,0 on the matrix when it first loads. I've turned autocam off and tried placing it with the place object command, with getgroundheight and different x and z positions. Any help would be greatly received. Thanks.
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 6th Jan 2005 10:53
You need to show us your code - most likely you have some code somewhere which is resetting it back to zero, but I can't see where without looking.


crowcity
19
Years of Service
User Offline
Joined: 2nd Jan 2005
Location: East of England
Posted: 6th Jan 2005 20:47
Cheers. Here's the code. It's a real mess in places as I've been trying stuff at random.
crowcity
19
Years of Service
User Offline
Joined: 2nd Jan 2005
Location: East of England
Posted: 6th Jan 2005 22:39
That didn't seem to work - I'll try and add it again
crowcity
19
Years of Service
User Offline
Joined: 2nd Jan 2005
Location: East of England
Posted: 7th Jan 2005 00:08
OK - didn't work again - will post here

SYNC ON
sync rate 30
Hide Mouse
autocam off
Draw to front
rem Position camera off center
rem POSITION CAMERA 0.0,0.0,-1000.0


Backdrop on

Set camera range 1,5000
Fog on
Fog distance 4000
Fog color RGB(128,128,255)
Color Backdrop RGB(128,128,255)

Rem make matrix
Make matrix 1,10000,10000,20,20

Rem texture matrix
Load image "grass09.bmp",1
Prepare matrix texture 1,1,1,1
Fill matrix 1,0,1

Rem Randomize the matrix
randomize matrix 1,220

rem Load 3D object and append walking data to it
LOAD OBJECT "M-Raptor-Idle.x",1 : APPEND OBJECT "M-Raptor-Move.x",1,100
Scale object 1,1000,1000,1000
YROTATE OBJECT 1,180 : FIX OBJECT PIVOT 1
rem Loop 3D object animation from 0 to 20 (idle)
LOOP OBJECT 1,0,20 : SET OBJECT SPEED 1,20
rem position dinosaur
position object 1,5000,Get Ground Height(1,5000,5000),5000
rem position object 1,0,-7,15
rem Lock object on 1

rem Begin loop
DO

Rem Store Object angle
CameraAngleY# = Camera angle Y()

rem Modify character angle based on left/right keys
stage=0
IF LEFTKEY()=1 THEN a#=a#-8.0
IF RIGHTKEY()=1 THEN a#=a#+8.0
a#=wrapvalue(a#)

rem Modify character position based on up/down keys
IF UPKEY()=1 THEN x#=NEWXVALUE(x#,a#,3) : z#=NEWZVALUE(z#,a#,3) : stage=1
IF DOWNKEY()=1 THEN x#=NEWXVALUE(x#,a#,-3) : z#=NEWZVALUE(z#,a#,-3) : stage=1

rem If character action changes
IF stage<>oldstage
IF stage=0
SET OBJECT FRAME 1,0.0
LOOP OBJECT 1,0,20
SET OBJECT SPEED 1,10
ENDIF
IF stage=1
SET OBJECT FRAME 1,105.0
LOOP OBJECT 1,105,125
SET OBJECT SPEED 1,40
ENDIF
oldstage=stage
ENDIF
rem Update character position and angle
Y# = Get Ground Height(1,X#,Z#)
POSITION OBJECT 1,x#,y#,z#
YROTATE OBJECT 1,a#

Rem get new camera position and store in cZ# and cX#
cZ# = Newzvalue(Z#,aY#-180,100)
cX# = Newxvalue(X#,aY#-180,100)
cy# = Newyvalue(y#,aY#-180,100)

Y# = Get ground height(1,X#,Z#)

Rem position camera
Position Camera cX#,y#+35,cZ#

Rem point the camera at the player object
Point camera X#,y#+35,Z#

rem Refresh screen
SYNC
rem End loop
LOOP
Dodo
20
Years of Service
User Offline
Joined: 8th Aug 2004
Location: eating lunch
Posted: 7th Jan 2005 00:58
post it using the [code ] tags - use like this:

[/code]

Part of solving the problem is actually noticing that the problem is there in the first place

Dodo
20
Years of Service
User Offline
Joined: 8th Aug 2004
Location: eating lunch
Posted: 7th Jan 2005 00:58
ok, that screwed up...

Part of solving the problem is actually noticing that the problem is there in the first place

Login to post a reply

Server time is: 2024-09-23 08:25:59
Your offset time is: 2024-09-23 08:25:59