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 / wlking on a sphere

Author
Message
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 9th Aug 2003 00:44
i am going to make a pacman game, but you are walking on a sphere collecting the dots. now the question....how do I make it so that nomatter where you are on the sphere, up will be up and down will be down, etc.?
"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
Attreid
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 9th Aug 2003 02:02
you want to know the angles from your player to the center of the sphere ?
I have made three functions that give the angles X,Y and Z between two objects, I post them here
(dax : angle X / day : angle y / daz : angle z)

then, if you know the size of your sphere, you just have to use trigo to position your player

"He will come...the voice from the outer world,
bringing the holy war, the Jihad, which will cleanse the Universe and bring us out of darkness."
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 9th Aug 2003 02:11
i'm sorry, but i am still a newbie....what do I have to insert into my code to use this? thanx again........whats trigo?

"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
CarlTaylor
21
Years of Service
User Offline
Joined: 13th Jan 2003
Location: United States
Posted: 9th Aug 2003 04:07
you could also try rotating the sphere instead of moving the camera itself to show movement... then up will always be up and down will always be down, but you will never have to move the camera. (what i mean is, make the arrow keys or whatever control the rotation of the sphere)

im not sure exactly what you have in mind so that may or may not work for you.

does any of that make sense?

-carl

P4 2gig, 256mb RAM, 64mb DDR NVIDIA GeForce4 Ti 4200 w/ TV Out
keeblerElf
21
Years of Service
User Offline
Joined: 11th Jun 2003
Location: United States
Posted: 9th Aug 2003 07:09
Rotate the sphere the player is walking on...say you want him to move up so you would rotate the sphere down

Live life and play video games
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 9th Aug 2003 09:30
thegreatwesus: that is exactly what i am doing, look a my code..

keeblerelf: I can't use the xrotate or yrotate or zrotate commands but i am using roll object and pitch object...

"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
Attreid
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 9th Aug 2003 10:16
if I've enough time, I'll do you an example this afternoon

"He will come...the voice from the outer world,
bringing the holy war, the Jihad, which will cleanse the Universe and bring us out of darkness."
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 9th Aug 2003 10:18
thanx attreid

"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
Attreid
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 9th Aug 2003 23:40
sorry, I didn't have time enough today (I left home at 8h30 Am and I came back at 9h20 PM)
I do it as soon as possible, but not today

"He will come...the voice from the outer world,
bringing the holy war, the Jihad, which will cleanse the Universe and bring us out of darkness."
iron
21
Years of Service
User Offline
Joined: 22nd Jul 2003
Location: United States
Posted: 10th Aug 2003 07:22 Edited at: 10th Aug 2003 07:31
`let me try:

hide mouse
autocam off
sync on
spheresize=128
position camera 0,spheresize/4,spheresize/2
point camera 0,0,0
make object sphere 1,spheresize
position object 1,0,0,0
load object "walk.x",2
position object 2,0,spheresize+(object height(2)/2),0
loop object 2,1,10
`camera angles
cax=0
cay=0
caz=0
numpills=6
`code to set up pills-details later
pillsleft=6
sp=4
do
if upkey() then inc cax,sp
if downkey() then dec cax,sp
if leftkey() then inc cay,sp
if rightkey() then dec cay,sp

`if collide with pill, dec pillsleft, hide pill
if pillsleft<=0 then goto _level_end

rotate object 1,sax,say,saz
`lots of fun math and trig here to reposition all your pills.
` like i said, details later.
sync
loop

_level_end:
`you get the idea

[:-] _message=does not compute./terminating.
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 10th Aug 2003 10:29
thanx iron for the try, but it dosn't work....it won't let you rotate the object with a negative value. Thanx anyway...

"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 11th Aug 2003 04:00
hey attreid....i think i figured your function out....are you suggesting that i keep my world sphere and move my player but keep him at the same distance from the center of the sphere? I never thought of that.....

"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
Attreid
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 11th Aug 2003 18:49
yes, I tried to do that, but it didn't work when I wanted to rotate the object to keep it with a 90° angle from the sphere...

"He will come...the voice from the outer world,
bringing the holy war, the Jihad, which will cleanse the Universe and bring us out of darkness."
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 11th Aug 2003 22:47
thanx all, but a friend helped me out...thanx again for the trouble

Bishop

"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."

Login to post a reply

Server time is: 2024-09-20 23:04:20
Your offset time is: 2024-09-20 23:04:20