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
Sync On
Sync Rate 60
Make Matrix 1,500 ,500,50,50
Randomize Matrix 1,4
Update Matrix 1
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)
set camera to object orientation 1
Position Camera X#,15,Z#
move camera -30
Sync
Loop
"
The answer is to look at the ground height at the X# and Z# position of the object. See this:
Sync On
Sync Rate 60
Make Matrix 1,500 ,500,50,50
Randomize Matrix 1,4
Update Matrix 1
Make Object Box 1,5,2.5,8
Position Object 1,500,3,0
HalfHeight# = object size y(1) / 2
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)
GY# = get ground height(1,X#,Z#) + HalfHeight#
position object 1,X#,GY#,Z#
set camera to object orientation 1
Position Camera X#,GY# + 15.0,Z#
move camera -35.0
Sync
Loop
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.