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 / ccccCCCoDiNg HeLpppPPPP

Author
Message
James Bond
22
Years of Service
User Offline
Joined: 20th Jul 2004
Location:
Posted: 25th Jul 2004 23:12
i want my 3d camera to follow my car but i'am having some problems .... so please help me .... add the camera code in the following code ..... please use this cube instead of my car: www.geocities.com/rehansites2/cube.zip



[b]CODEb]
Rem Setup sync rate
Sync On
Sync Rate 30

Rem Create sphere
load object "c:\cube.x",1

Rem Main loop
Do
Rem Store the object's Y angle in aY#
aY# = Object angle Y(1)

Rem Control input
If Upkey()=1 then Move object 1,2
If Leftkey()=1 then aY# = Wrapvalue(aY#-5)
If Rightkey()=1 then aY# = Wrapvalue(aY#+5)

Rem rotate the sphere
Yrotate object 1,aY#

Rem Refresh Screen
Sync
Loop
Don Malone
23
Years of Service
User Offline
Joined: 27th Apr 2003
Location: Birmingham, Alabama
Posted: 25th Jul 2004 23:28
I am no expert but I seem to be missing the camera control code.
But like I say I am far from an expert.

For more info on using the camera I suggest the Binary Moon tutorials.
The section for Camera is here
http://developer.thegamecreators.com/?f=t02/bm_tutorial_21

sorry I could not be more help.

Wasting CPU Cycles since the 286 was a hot machine.
bibz1st
23
Years of Service
User Offline
Joined: 2nd Jan 2003
Location:
Posted: 26th Jul 2004 00:03
CODE:
Rem Setup sync rate
Sync On
Sync Rate 30

Rem Create sphere
load object "c:\cube.x",1

Rem Main loop
Do
xpos#=object position x(1)
ypos#=object position y(1)
zpos#=object position z(1)

Rem Store the object's Y angle in aY#
aY# = Object angle Y(1)

Rem Control input
If Upkey()=1 then Move object 1,2
If Leftkey()=1 then aY# = Wrapvalue(aY#-5)
If Rightkey()=1 then aY# = Wrapvalue(aY#+5)

Rem rotate the sphere
Yrotate object 1,aY#

Rem alter values of v1#,v2#,and v3#
Set Camera To Follow x#,y#,z#,ay#,v1#,v2#,v3#,0

Rem Refresh Screen
Sync
Loop
James Bond
22
Years of Service
User Offline
Joined: 20th Jul 2004
Location:
Posted: 26th Jul 2004 00:08
i tried ur code but:
Syntax Error. Unknown Command At Line 26

please remove all these errors!!
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 26th Jul 2004 01:45
If object 1 is your car and X,Z are its coordinates:

cx# = newxvalue(x#,wrapvalue(object angle y(1)+180),100)
cz# = newzvalue(z#,wrapvalue(object angle y(1)+180),100)
cy# = object position y(1)
position camera cx#,cy#+100,cz#
point camera x#,y#,z#

"eureka" - Archimedes
Jess T
Retired Moderator
22
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 26th Jul 2004 08:51

James,
Again, I ask that you DO NOT post with your thread titles like you have them.
It looks quite ugly on the board, and you MUST be alot more descriptive in the title, otherwise people will not reply.

Also, it apears that you have made no attempt whatsoever to code the camera movement yourself, or have even looked into the Syntax Error that occured with bibz1st's code.

Come back again when you have at least TRIED to do it yourself, and can show some code to prove it.
I refuse to write code for those that do not try it themselves first, but, I will however provide advice and point you in the right direction.
Provided that you are polite and friendly.

Thanks,
Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
James Bond
22
Years of Service
User Offline
Joined: 20th Jul 2004
Location:
Posted: 26th Jul 2004 13:13
still it is not working correctly .... the camera is displayed from TOP .... here is the car model i was talking about!!
http://www.geocities.com/rehansites2/carx.zip
please use this car model while codingRem Setup sync rate
Sync On
Sync Rate 30
Updated Code After Reading All The Posts
CODE:

Rem Create sphere
load object "c:\cube.x",1

Rem Main loop
Do
xpos#=object position x(1)
ypos#=object position y(1)
zpos#=object position z(1)

Rem Store the object's Y angle in aY#
aY# = Object angle Y(1)

Rem Control input
If Upkey()=1 then Move object 1,2
If Leftkey()=1 then aY# = Wrapvalue(aY#-5)
If Rightkey()=1 then aY# = Wrapvalue(aY#+5)


cx# = newxvalue(x#,wrapvalue(object angle y(1)+180),100)
cz# = newzvalue(z#,wrapvalue(object angle y(1)+180),100)
cy# = object position y(1)
position camera cx#,cy#+100,cz#
point camera x#,y#,z#

Rem Refresh Screen
Sync
Loop!!
Jess T
Retired Moderator
22
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 27th Jul 2004 08:55
Hmm, I take it you just skipped straight over my post then?

Ok.

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Balid
22
Years of Service
User Offline
Joined: 21st Nov 2003
Location: MI, USA
Posted: 27th Jul 2004 11:38
James Bond,

If the camera is higher then what you want, change the cy# + 100, to a smaller number. If the camera is too close to the car then increase the last number of cx# and cz# (...,100))

I agree with JessTicular. Must people take offense to someone asking to just do this for me without showing that they have tried themselves.

But your new, so next time please show what you have already tried that way everyone knows that you tried.

BearCDPOLD
22
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 27th Jul 2004 13:06
I remember several people asking you to fix your thread titles.

Crazy Donut Productions, Current Project: Project Starbuks
Sony stole our name!

Login to post a reply

Server time is: 2026-07-26 16:56:14
Your offset time is: 2026-07-26 16:56:14