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 / please help to place characters on a sphere

Author
Message
Simian
20
Years of Service
User Offline
Joined: 16th Feb 2004
Location: my room
Posted: 16th Feb 2004 14:25
Hi all,

for my first game i'd like to have characters running around a small 'planet'

my problem is figuring out how to place characters on the planet-sphere 'cause i obviously cant use the traditional x,y,z positions as I would for a 2D plane.
So I thought about using angles as coordinates, and placing my characters this way.

using my function with (0,0,0) as inputs works fine, but as soon as i change the values, the characters starts 'floating' off the planet.

Anyone have any ideas, or maybe a better/easier method?

ps, i'm using DBC
Phrozin
21
Years of Service
User Offline
Joined: 16th Jun 2003
Location: Florida USA
Posted: 16th Feb 2004 15:49
not sure as I've only been doing this for 2 days, but I was reading somewhere that the COS and SIN where used for something like this. maybe it was TAN. Anyway from what I remember, COS is Cosine and is the horizontal coordinate of an arc endpoint, SIN being Sine is the vertical coordinate of an arc. And TAN does something with them both.

I've never used them, but made notes of what I was reading for future reference. Not much help, but at least you have 3 terms to look for now that might help.

Phrozin
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 16th Feb 2004 17:37
Search the threads of this forum for 'tiny world', I wrote a polar coordinate navigation system that might help.
--
TAZ

Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 16th Feb 2004 17:38
I think using angles is a good method - but positioning an object at a set radius would be quite tricky to work out.

You could try experimenting with an offset limb on a dummy object.

Try making a sphere for the planet, then a small cube. Now create a mesh from the cube and add the cube mesh to the planet object. Offset the cube up by the radius of the planet. E.g. if the planets radius is 10000 units, offset the cube like OFFSET LIMB Planetobj,1,0,10000,0

Once you have that, you can simply rotate the cube on the planet to suit the angle then you have the coordinates in the limb positions. ROTATE LIMB Planetobj,1,X,Y,Z

You could rotate the object by the same angles to keep it sensible.


Van-B


The nature of Monkey was irrepressible!.
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 16th Feb 2004 19:37 Edited at: 16th Feb 2004 19:38
I skipped the limb method. I went with rotating the player object at the planet's origin and used move object to set the radius.
--
TAZ

Silly me, the source code and resources are on my own web site:
http://www.geocities.com/tzircher/tiny_world.htm

Simian
20
Years of Service
User Offline
Joined: 16th Feb 2004
Location: my room
Posted: 17th Feb 2004 13:31
thanx all for your comments.

I have tried zircher's method before, and it works fine, but my idea was more to be able to place the object on the sphere at a given position(or in this case "set of angles"), 'cause I wanna send player positions over a LAN and put it at the appropriate place on another pc. (bit longwinded sentence, but you know what I mean

I did actually get it right though, and I'll put that bit of code up soon, just in case someone else might need it later. Just smoothing out the last creases
Simian
20
Years of Service
User Offline
Joined: 16th Feb 2004
Location: my room
Posted: 18th Feb 2004 09:06
okay, so here is what i got. hope it will help someone else in future.



...oh and thanks again for everyone's help
Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 20th Feb 2004 19:13
This is all very complex.

I think the easiest way of doing this is to use a spherical 3d coordinate system.

See: http://darkbasicpro.thegamecreators.com/?m=forum_view&t=24711&b=15

Although that is actually a bug report about the point camera command the attached code demonstrates how to easily and simply use spherical 3d coordinates.

Philip

What do you mean, bears aren't supposed to wear hats and a tie? P1.3ghz / 384 megs / GeForce MX 5200 128meg / WinXP home

Login to post a reply

Server time is: 2024-09-21 22:36:18
Your offset time is: 2024-09-21 22:36:18