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.

DarkBASIC Discussion / Gravitational Pull for cyberplanets

Author
Message
RUCCUS
20
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 15th Apr 2006 06:53 Edited at: 15th Apr 2006 06:55
You're all going at this with methods way too complex than what is required. Here's what you do:

- Add an invisible limb to a dummy object positioned at the planet's position. Offset the limb ONLY on one axis (x, y, or z [I'd use z]).
- Store the X,Y,Z positions of the player object's starting point
- Position the Player Object at the Planet's Position
- Point the player object at the X,Y,Z positions
- Store these angles
- Reposition the player object at it's starting position
- Rotate the limb object to the stored angles, now the limb is at the same position as the object's starting point.
- Each loop, instead of moving the player object, rotate the limb. Then position the player object at the limb's coords.
- Also each loop, check for intersection between the limb and the planet's position. If an intersection occurs, increase the offset on the chosen axis from step 1 by the distance from the player object to the intersection.

Voila, you've now got the vehicle following along the planet's surface, going up and down the hills and bumps.

Ill post back with a demo if I can get one going in the next few minutes, if not the above theory should be enough to get you going.

- RUC'

vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 15th Apr 2006 10:29 Edited at: 15th Apr 2006 12:15
Thanks RUCCUS but I manged to get the hovercraft to be able to "jump",(this would be for skirtless hovercraft) will this be able to be done in your example?
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 15th Apr 2006 16:53
A smooth sphere is easy to drive around, that's just an orbit, and there is even an orbit example in the DB Classic help files I think.

When you have hills, it gets much harder. I suppose you could have spherical hills, and then you just have orbits within orbits. An orbit of the large planet changes to an orbit of the hill, and then back to an orbit of the planet again. The hills would look a bit funny though, more like Mariocart hills.

vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 15th Apr 2006 20:35 Edited at: 15th Apr 2006 20:38
Yeah pity you couldn't get Bryce models and take the hills and moutian models out of that and stick them on a sphere, I haven't seen that file Pincho and I will look for it, still I got the vehicle to drive on a planet with a ton of help from Vice I also maganed to get my hovercraft to straffe as well with a lot of help from Vice but now the problem is getting the planet to look like a planet and to have hills and mountains and lakes and sea's.

I am afraid I tried Mojoworld2.0se planets and I usually have to put them into Poser and that takes away the hills and mountains when you export it to Dark Basic
RUCCUS
20
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 15th Apr 2006 20:57
Like I said, cast an intersection ray downwards going from the object's position to the planet's center, if an intersection occurs move the object upwards by the distance from the object to the intersection.

vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 16th Apr 2006 00:16 Edited at: 24th May 2006 04:53
As I am not that great a programmer how do you cast an intersection ray exactly ? and can you use joyustic as well as keyboard commands to straffe the player object as well as move forward and backward with your method?
RUCCUS
20
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 16th Apr 2006 01:54
Well you're using DBC, so the Intersect Object command is out of the question. You'll need to download Sparky's Collision dll or purchase NGC to obtain the collision information.

As far as my method goes stick with your movement method it takes a while to get mine correct, but the collision theory should still be the same.

vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 16th Apr 2006 02:20 Edited at: 16th Apr 2006 02:28
I see well I shall just leave a version on what I have been working on and what I got help with Vice with so you can see the method I am working on



It works but I have problems making it work with imported models and getting the scaling right and the mountains and hills I want but I have DBP so I will try the intersect object in there, but just goes to show how much flexible live Dark Basic Classic still has in it

Login to post a reply

Server time is: 2025-05-23 23:08:18
Your offset time is: 2025-05-23 23:08:18