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 / Ugh ;) Confused.

Author
Message
Paul J
21
Years of Service
User Offline
Joined: 6th Nov 2002
Location:
Posted: 7th Nov 2002 02:43
Finally - I've managed to sign up to the forum and although I haven't purchased DB Pro yet (will do asap) - I've got myself into a tizz on the trial version... I have a bit of previous coding knowledge, but are relatively new to DB.

I originally made a 3D flight game that simply had forces involved. For example you press space + it accelerates upwards, till u lift off - then gravity is calculated and the velocity decels and then the objects starts going down - and if u thrust again it starts acceling and the vel starts going back up... in a smooth way.

I then thought, ok thats cool... but lets take it 1 step further - so I added the fuel# variable which also effected the mass... So when I thrusted initially the ship was heavy and accelerated slowly and as it used fuel the ship got lighter...

Then things started to go pear shaped.

I started making it so not only could u thrust directly up now, but u could thrust from the bottom of the ship - so if u tilted it nose forward - it went up + forward. With gravity acting directly down. Then it all went a bit strange, only flying in one direction and other strange things, but that I know is only due to my strange and bizarre code and since I only have the trial version (with no help files) I'm sure I was doing it in a strange way

So I left that idea for a while, and wanted to attempt to make a frictionless (space like) sim... I decided I would only attempt this on the horizontal axis for now to keep things simpler.

What I was trying to achieve, is an effect where u can thrust in 1 direction - then cut off the thrust and continue in that direction, no matter which way u then turn and face...

Then u can spin 180 and face the other way (still flying in the same direction as before) and thrust to head the other way.

Now I'm guessing there's a simple way of doing this, but what I've done has just turned into a complete MESS!

If I remember anything from my A-Level Maths Mechanics, doing things like vectors - I used to be able to calculate the forces to the x + y...

Now I think this is what I need to do here?

So if I'm facing at an angle of 36 - it adds A amount to X and B amount to Y... sending my ship in a diagonal.

I originally tried this by (for 0-90 degrees) calculating the 0-1 for the force to X and force to Y... for example... for 0-90 degrees, then 90-180, etc... then dividing that by 90 to get a figure from 0-1

if angle# > -1 and 90 and 180 and 270 and
Paul J
21
Years of Service
User Offline
Joined: 6th Nov 2002
Location:
Posted: 7th Nov 2002 02:48
LETS TRY THAT AGAIN!


Finally - I've managed to sign up to the forum and although I haven't purchased DB Pro yet (will do asap) - I've got myself into a tizz on the trial version... I have a bit of previous coding knowledge, but are relatively new to DB.

I originally made a 3D flight game that simply had forces involved. For example you press space + it accelerates upwards, till u lift off - then gravity is calculated and the velocity decels and then the objects starts going down - and if u thrust again it starts acceling and the vel starts going back up... in a smooth way.

I then thought, ok thats cool... but lets take it 1 step further - so I added the fuel# variable which also effected the mass... So when I thrusted initially the ship was heavy and accelerated slowly and as it used fuel the ship got lighter...

Then things started to go pear shaped.

I started making it so not only could u thrust directly up now, but u could thrust from the bottom of the ship - so if u tilted it nose forward - it went up + forward. With gravity acting directly down. Then it all went a bit strange, only flying in one direction and other strange things, but that I know is only due to my strange and bizarre code and since I only have the trial version (with no help files) I'm sure I was doing it in a strange way

So I left that idea for a while, and wanted to attempt to make a frictionless (space like) sim... I decided I would only attempt this on the horizontal axis for now to keep things simpler.

What I was trying to achieve, is an effect where u can thrust in 1 direction - then cut off the thrust and continue in that direction, no matter which way u then turn and face...

Then u can spin 180 and face the other way (still flying in the same direction as before) and thrust to head the other way.

Now I'm guessing there's a simple way of doing this, but what I've done has just turned into a complete MESS!

If I remember anything from my A-Level Maths Mechanics, doing things like vectors - I used to be able to calculate the forces to the x + y...

Now I think this is what I need to do here?

So if I'm facing at an angle of 36 - it adds A amount to X and B amount to Y... sending my ship in a diagonal.

I originally tried this by (for 0-90 degrees) calculating the 0-1 for the force to X and force to Y... for example... for 0-90 degrees, then 90-180, etc... then dividing that by 90 to get a figure from 0-1

if angle# > -1 and < 90 then angle2#=angle#
if angle# > 90 and < 180 then angle2#=angle#-90
if angle# > 180 and < 270 then angle2#=angle#-180
if angle# > 270 and < 360 then angle2#=angle#-270

angle2#=angle2#/90
angle3#=1-angle2#

This means, for 0-90 deg, when ship is facing at 45 degrees, angle2# and angle3# both equal 0.5 - therefore sending half the force to x and half to z on the horizontal.
Creating the resultant force - which is what I think I want.

this is where it all went abit messy and I've kinda lost where I was in my code etc lol

I have this to control the thrust.

if spacekey()=1 then t#=t#+0.1
if spacekey()=0 then t#=0
v#=v#+(a#*t#)

Notice the good old Mechanics equation of motion lol V=U+A*T

and then this is where my code just turned into gibberish... What it meant to do, was work out the force going in a direction depending on where abouts it was facing... For example if its at 0 deg - it adds to xp2# and if facing 180 it adds to xn2#... so vel in the X axis = (xp2#-xn2#)

then u enter it into the postion object (x) part and do similar for the rest of the angles + the z axis... Sadly it just doesn't work... sending the ship in weird directions... Probably coz I've put some things in wrong (which would of been easy with the code I used) - but I'm wondering whether there is a much easier way to do this - or if my way 'the way I described it' would work if I just keep fiddling?

Note, I don't simply want a craft to fly where I point it - I want it to only have force acting when Im thrusting... so when spacekey()=0 then no forces are changing - regardless of whether u turning ur ship around or whatever...

If you have ever played a space game with proper realistic physics you'll understand what I was trying to achieve.

Cheers for any help guys, I love DB Pro even though Im only a newbie I hope to learn fast and can help people like myself when I'm more experienced.

Thanks again,

Paul J

Login to post a reply

Server time is: 2024-03-01 04:13:21
Your offset time is: 2024-03-01 04:13:21