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 / 3D Spheres and Matrixes

Author
Message
vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 5th Jan 2006 18:17 Edited at: 5th Jan 2006 18:20
I was wondering if you can wrap a matrix or several matrixes around a sphere ? the reason I am asking is because I am still working on getting ground vehicles to drive and follow a sphere/planet surface rather than do an edge of the world or infinate matrix but I am having some problems getting my planets to import into Dark Basic and keep their mountains ands oceans and hills e.t.c

Also I am still having problems getting my vehicles to follow the planet's crust so I was wondering if that was possible and how is it done?
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 6th Jan 2006 11:00 Edited at: 6th Jan 2006 11:01
It's not possible to have 2 matrix points on the same X/Z place. Therefor, you can't do it...

What is possible, is create 2 matrices where each matrix wraps 1 half of the sphere. Side effect would be the corners 'sticking' out of the sphere due to the square form of a matrix.
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 6th Jan 2006 12:03
Do you really want a spherical planet? We live on a sphere but it looks flat. You can zoom in on a planet, then pass through some clouds, and swap the planet for a matrix, or a model.

Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 6th Jan 2006 20:17
Quote: "Do you really want a spherical planet? We live on a sphere but it looks flat. You can zoom in on a planet, then pass through some clouds, and swap the planet for a matrix, or a model."


I believe it is. vampyre started a thread a few months ago about his project in space. Because matrices are easy to get the ground height from, I think that's the reason why he asked this question.

You can't do much with a matrix when you're in a space enviroment with planets and stars
vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 18th Jan 2006 11:16 Edited at: 6th Apr 2006 16:42
Sorry for taking so long to reply well the thing is I want my game to allow the player to fly from a planet right into space without having to load another level to give the appearance of that.

Yes Sven B you are right a matrix would be easier to get the ground hieght from so I was thinking have the matrix wrap around a sphere also I could make mountains and hill e.t.c much easier than trying toinport it into DBC from Mojoworld 2.0SE whic I have I am going tobuy 3.0 but I tend to have to inport it into Poser 4.0 and then import it into Dark Basic and I tend to lose all the Moutains and hills I create.

Also I am still stumped on how to get one object to stay on the surface of another object i.ea ground vehicle stay on the surface of a planetI would need help on how to do gravity properly and still allow flying vehicles to leave the planet
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 18th Jan 2006 11:50 Edited at: 18th Jan 2006 14:26
Personally this is what I would do:

Make your planet, either a sphere, or whatever, maybe a model with some hills etc. Don't use a matrix.

you then have to calculate the coords of where on the planet you want to be at (roughly).




Then, to stay above the mountains, you would cast a ray from yourself to the center of the planet. Then find your distance, from the planet.



Then, the next stage is pretty much like the first one, instead we need to calculate it using the distances we just found.


So, lets say the distance we just found in that picture was called d, the angles between you and the center of the planet are called, ax, and ay. This is how we calculate the coords that we wanna land on:



Then, if you wanna land, just use the curvevalue command to turn your current values into land pos x etc.

One thing: DBC doesn't suppost ray casting, check out sparky's collision dll


[edit]

Here's a small example of it in 2d, obviously it's not as fully made as it should because it doesn't have mountins and stuff, but just to show you roughly what I mean. It will calculate roughly where you want to land, excluding hills and stuff, but this is in 2d, the equations in 3D are slightly difernt because youve to take another angle value into account.



Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 18th Jan 2006 16:15
Zotoaster,

When using raycasting, you just calculated the point where it will land. Which means there's no need for all the calculations actually...

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 18th Jan 2006 19:12
You calculate the distance from you to the ground. You really dont calculate the positions, but I guess using similar techinques you can work it out from the player.

vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 19th Jan 2006 11:10
I see Zotoaster,thanks, Idid do simpler thing where I entered the collisions for the planet and collisions for my space plane but Imight need these forwhen I can work out gravity to hold planet based vehicles to the surface of the planet

Login to post a reply

Server time is: 2025-05-23 06:52:49
Your offset time is: 2025-05-23 06:52:49