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 / rotational problems

Author
Message
jomo
21
Years of Service
User Offline
Joined: 31st Oct 2002
Location: Ireland
Posted: 13th Nov 2002 10:43
im making a game in whick you control a cannon and you have to shoot badies (spheres) that are attacking you
its in the early stages anyway...
im trying to amke the cannon rotate and i can get it to rotate on the horizontal plane with the camera always behind it
now i need to tilt the cannon up and down
ive tried a few things (pivot up/down) but it doesnt seem to work
remarked out the up and down key loops to see how the rst of the code works

thanks for any help
slan
jomo

`MAKE BARREL (SCALE,ROTATE)
make object cube 1,10
scale object 1,100,100,1000

position object 1,0,0,50

color object 1,RGB(168,168,168)

`MAKE MATRIX
make matrix 1,100,100,10,10
position matrix 1 ,0,0,0

sync on
sync rate 30

`CONSTANTS
cameraangle# = -90

theta_angle# = 0
phi_angle# = 0

theta# = 90
phi# = 0
speed# = 1
position camera 0,200,-200

do
set cursor 0,0


if downkey() = 1
phi# = phi# + 1
if phi# > 45 then phi# = 45
pitch object up 1,phi#
endif

if upkey() = 1
phi# = phi# - 1
if phi#
jomo
21
Years of Service
User Offline
Joined: 31st Oct 2002
Location: Ireland
Posted: 14th Nov 2002 22:06
ok if noone can answer can someone at least direct me to a good 3 dimensional coordinate tutorial or something...

thanx
jomo
Flashing Blade
21
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 14th Nov 2002 22:37
there seems to be a whole chunk of code missing from your post, but from the downkey() code i think you want to pitch your object 1 point at a time as long as this stays below 45.
But by pitching by phi# you are pitching - 1,2,3,4,5,6.. etc

try changing to this:
if downkey() = 1
phi# = phi# + 1
if phi# > 45 then phi# = 45
if phi#<45 then pitch object up 1,1
endif

can't see any difference between pitch object and xrotate object - but i dbp n00b too.
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 14th Nov 2002 23:52
Xrotate object may or may not be relative to the object/screen/world coordinates depending on the version you are using and whatever other posts moaning about rotations say. Pitch object up should be relative to the object, but for some reason may or may not be, again depending on versions.

Login to post a reply

Server time is: 2024-04-19 01:24:31
Your offset time is: 2024-04-19 01:24:31