I was messing around with a plane from the darkmatter collection
I haven't done much yet but I'm trying to get the physics down for how the plane flies.
I have a plane speed and when you press the up arrow or down arrow
the plane pitches up or down and then I use sin, cos to get how
fast the plane should go up down forward backward. that all works great.
my question is when I hit left or right arrow key I roll the plane
I don'the physics to figure out the effects of that on my horizontal movement (and does it effect up and down as well maybe a pilot knows) anyway I attached what I have so far so you can download it if you like, it will be much easier to see what I'm talking about
Rem Project: airplane
Rem Created: 7/20/2010 5:00:06 PM
Rem ***** Main Source File *****
GLOBAL PROPELLER_LIMB = 4
GLOBAL AIRPLANE_OBJ = 1
type airplane_t
xangle#
zangle#
yangle#
prop_zangle#
xposition#
yposition#
zposition#
speed#
xspeed#
yspeed#
zspeed#
endtype
global airplane as airplane_t
airplane.xangle# = 275
airplane.zangle# = 0
airplane.zposition# = 0
airplane.xposition# = 1
airplane.speed# = .1
load object "Sopwith-Camel\Sopwith-Camel.x", AIRPLANE_OBJ
rotate object AIRPLANE_OBJ, xangle#, 0, 0
autocam off
do
prop_yangle# = wrapvalue(prop_yangle# + 15)
rotate limb AIRPLANE_OBJ, PROPELLER_LIMB, 0,prop_yangle#,0
if upkey() then airplane.xangle# = wrapvalue(airplane.xangle# + .1)
if downkey() then airplane.xangle# = wrapvalue(airplane.xangle# - .1)
if leftkey() then airplane.zangle# = wrapvalue(airplane.zangle# +.1)
if rightkey() then airplane.zangle# = wrapvalue(airplane.zangle# -.1)
rotate object AIRPLANE_OBJ, airplane.xangle#, 0, airplane.zangle#
airplane.zspeed# = cos(wrapvalue(airplane.xangle# - 275)) * airplane.speed#
airplane.zposition# = airplane.zposition# + airplane.zspeed#
airplane.yspeed# = sin(wrapvalue(airplane.xangle# - 275)) * airplane.speed# * -1
airplane.yposition# = airplane.yposition# + airplane.yspeed#
`airplane.xspeed# = ?????
`airplane.xposition# = ????
position object AIRPLANE_OBJ, airplane.xposition# , airplane.yposition#, airplane.zposition#
`position camera 1, airplane.yposition# +100, airplane.zposition# -600
position camera 1, 100, -100
debug()
loop
function debug
text 450, 15, "airplane x angle "+ str$(airplane.xangle#)
text 450, 30, "airplane y angle "+ str$(airplane.yangle#)
text 450, 45, "airplane z angle "+ str$(airplane.zangle#)
text 450, 60, "airplane z position "+ str$(airplane.zposition#)
text 450, 75, "z speed " + str$(airplane.zspeed#)
text 450, 90, "airplane y position "+ str$(airplane.yposition#)
text 450, 105, "y speed " + str$(airplane.yspeed#)
text 450, 120, "x speed" + "??????"
text 450, 135, "x position" + "???????"
endfunction