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 / Camera rotate

Author
Message
Jasmin
12
Years of Service
User Offline
Joined: 18th May 2012
Location:
Posted: 18th May 2012 13:31
Hy everydody..
I made this "car movement" object..and I need help about rotate camera...

This is code...

________________________________________________

Sync On
Sync Rate 60

Make Matrix 1,500 ,500,50,50


Make Object Box 1,5,2.5,8
Position Object 1,500,3,0

Do

y#=Object angle y(1)

If Keystate (17) Then Move Object 1,0.5
If Keystate (31) Then Move Object 1,-0.5

If Keystate (30) Then y#=Wrapvalue(y#-1.5)
If Keystate (32) Then y#=Wrapvalue(y#+1.5)

yrotate object 1,y#

X#=Object Position X(1)
Z#=Object Position Z(1)

X1#=Newxvalue(X#,180,3)
Z1#=Newzvalue(Z#,180,20)

Position Camera X1#,15,Z1#
Point Camera X#,5,Z#
Sync
Loop

____________________________________

Help !

Jasmin
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 18th May 2012 16:53
You can enclose your code in a nice snippet box when posting by clicking the CODE button, pasting your code and then clicking the CODE button again. It makes it much nicer.

Anyway, what problem are you having? The 'car' rotates just fine. If you are wanting the camera to always stay right behind the car, you could do it like this:



You'll notice that your code has been indented; a good practice to follow, as it lends itself to making it more readable.

If you are having a different problem, please state what it is clearly.

So many games to code.......so little time.

Jasmin
12
Years of Service
User Offline
Joined: 18th May 2012
Location:
Posted: 18th May 2012 17:12
Thanx Man..I'm new on forum...
Now I have another problem..and don't know how to solve it..
I want that my box float on matrix when it's randomized...
not just go lineal..
btw. sorry 4 my bad english.. I am from Bosnia and Herzegovina


Jasmin
Jasmin
12
Years of Service
User Offline
Joined: 18th May 2012
Location:
Posted: 18th May 2012 17:13
Thanx Man..I'm new on forum...
Now I have another problem..and don't know how to solve it..
I want that my box float on matrix when it's randomized...
not just go lineal..
btw. sorry 4 my bad english.. I am from Bosnia and Herzegovina


Jasmin
Jasmin
12
Years of Service
User Offline
Joined: 18th May 2012
Location:
Posted: 18th May 2012 17:14
Thanx Man..I'm new on forum...
Now I have another problem..and don't know how to solve it..
I want that my box float on matrix when it's randomized...
not just go lineal..
btw. sorry 4 my bad english.. I am from Bosnia and Herzegovina


Jasmin
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 18th May 2012 20:04
Tagging in

Also Hi Jasmin welcome to the forums

LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 18th May 2012 20:36
I need to get to work and I can't wait for a Mod to approve Jasmin's post, so here it is:

Quote: "Thanx Man..I'm new on forum...
Now I have another problem..and don't know how to solve it..
I want that my box float on matrix when it's randomized...
not just go lineal..
btw. sorry 4 my bad english.. I am from Bosnia and Herzegovina
"


The answer is to look at the ground height at the X# and Z# position of the object. See this:


This actually moves the camera with the terrain. You may or may not want it to do that. Note that it is necessary to add half of the object's height to get correct Y placement. Any questions? We're here to help.

So many games to code.......so little time.

MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 18th May 2012 22:36
Quote: "Bosnia and Herzegovina"


Good Music! [Eurovision]

Jasmin
12
Years of Service
User Offline
Joined: 18th May 2012
Location:
Posted: 19th May 2012 08:14
Thanx LBFN U're really helped me
MrValentine : Hey...greetings from Bosnia and Herzegovina

btw. LBFN..now I'll try to make FPS with this code..do move camera with "WASD" and with randomize matrix...again with floating on it..Tnx one more time

Jasmin

Login to post a reply

Server time is: 2024-11-22 00:25:13
Your offset time is: 2024-11-22 00:25:13