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.

Author
Message
XERO GAMES
20
Years of Service
User Offline
Joined: 12th Nov 2003
Location:
Posted: 21st Mar 2008 13:53
First of all, sorry for my broken English.

I want to make a code where a object (cube) \'walks\' over a sphere. It also has gravity. So if the cube walking straigt he doesn\'t just goes into the air but he still stand over the sphere. (sorry)

It\'s like the earth. If you\'re in Australia then you\'re on the ground but if you\'re in Holland you\'re also standing on the ground. That\'s what i want to make.

I\'ve tried it now for days but It doesn\'t work...

Can someone please help me?

I read this one; http://forum.thegamecreators.com/?m=forum_view&t=126238&b=30 But I doesn't help either

lala
nitrohaze
21
Years of Service
User Offline
Joined: 21st Apr 2003
Location:
Posted: 21st Mar 2008 14:55 Edited at: 21st Mar 2008 15:24
Hi Xero

I saw your post in the other forum and started to look into it for you but then you moved it to here

I had to do this about 15 years ago for a c++ project (long before the days of direct X, on a sun sparc workstation). I had a really elegant solution but cant quite remember it.......However I have cobled this together for you , using the arrow keys it will move a feb sphere around the a lighter/larger white one.

Is this the sort of thing you are after if it is I can explain how to use. See the attached code.


make object sphere 1,200,30,30
position object 1,0,0,0

make object sphere 2,20,30,30
color object 2,rgb(255,0,0)

position camera 400,400,400
point camera 0,0,0

ang1=90
ang2=45

do
if upkey()
inc ang1
ang1=wrapvalue(ang1)
endif

if downkey()
dec ang1
ang1=wrapvalue(ang1)
endif

if leftkey()
inc ang2
ang2=wrapvalue(ang2)
endif

if rightkey()
dec ang2
ang2=wrapvalue(ang2)
endif

x=100*(sin(ang1)*cos(ang2))
y=100*(sin(ang1)*sin(ang2))
z=100*(cos(ang1))
position object 2,x,y,z
loop
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 21st Mar 2008 15:27
I think there's some force field commands you can use. If you made a force field and placed it in the center of the sphere, than all objects would be stuck on it.
nitrohaze
21
Years of Service
User Offline
Joined: 21st Apr 2003
Location:
Posted: 21st Mar 2008 16:22
Hi Moderator, I posted a solution earlier for Xero but its not appearing. It did do but now its vanished after I edited.

Xero, is this roughly what you are after?

XERO GAMES
20
Years of Service
User Offline
Joined: 12th Nov 2003
Location:
Posted: 21st Mar 2008 16:39 Edited at: 21st Mar 2008 16:41
I didn't see your reply


GREAT!!!
Thank you so much _O_

lala
nitrohaze
21
Years of Service
User Offline
Joined: 21st Apr 2003
Location:
Posted: 21st Mar 2008 17:16
Xero

Remember if you are using a more complex object you will need to orientate your model as it moves around the sphere. To do this just use the point object command to point to the centre (x,y,z) of the sphere.

You might need to adjust the orientation by 180 degrees etc depending on the vertical(z) axis through your model.
XERO GAMES
20
Years of Service
User Offline
Joined: 12th Nov 2003
Location:
Posted: 21st Mar 2008 18:56 Edited at: 21st Mar 2008 19:17
I don't follow you how to that with 180 degrees, sorry.

Now I'm trying to have a 3rd person camera after it, but it doesn't follow him ...

Can you please help me?

lala
nitrohaze
21
Years of Service
User Offline
Joined: 21st Apr 2003
Location:
Posted: 21st Mar 2008 19:28
Hi Xero

Have you looked at the Set Camera to Follow Command?

SET CAMERA TO FOLLOW X, Y, Z, Angle, Distance, Height, Smooth, Collision

The X,Y,Z should be replaced with your object co-ordinates, which can be determined using object position commands, ie OBJECT POSITION X(Obj. No.).

A bit of experimentation on the other parameters along with using DB Pro help should get you up and running.

Hope that helps, otherwise you could post an example or screen shot to highlight the problem?

Thanks


nitrohaze
21
Years of Service
User Offline
Joined: 21st Apr 2003
Location:
Posted: 21st Mar 2008 19:43
Xero

Actually Ive amended my example to give you an overhead example. you will need to play with the angles ang1, ang2 if you want to offset slightly. Spherical Geometry can become very difficult. Depending on what you are trying to achieve you may be better off moving the objects on a sphere rather than the "player"

Can you post an image?

XERO GAMES
20
Years of Service
User Offline
Joined: 12th Nov 2003
Location:
Posted: 22nd Mar 2008 10:29 Edited at: 22nd Mar 2008 12:19
Hey it's doing weird...
I want that my camera always behind it is, and the view doesn't change when it is at the top of the sphere.

It has to look like the greater sphere is rotating.

Here an image;

lala

Attachments

Login to view attachments
Serial Design
16
Years of Service
User Offline
Joined: 13th Nov 2007
Location: Michigan, USA
Posted: 25th Mar 2008 10:15
Wow this code could be used to make some really good over head shooter arcade type games that wrap paround spheres, thanks so much!
XERO GAMES
20
Years of Service
User Offline
Joined: 12th Nov 2003
Location:
Posted: 25th Mar 2008 19:51
Can you help me then?

I want the camera always behind the 'playing object'. That the view doesnt change...

lala
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 9th Apr 2008 05:58
xero
you need to apply the same sphere math to the camera

Login to post a reply

Server time is: 2024-05-19 18:51:57
Your offset time is: 2024-05-19 18:51:57