Aerodynamics problem

Blitz3D Forums/Blitz3D Programming/Aerodynamics problem

Specis(Posted 2004) [#1]
Lo all,

Been working on a small concept demo, just a small dogfight basically got puter control craft in following waypoints but as im testing it, it feels like its missing something, the speeds are constant, which doesnt seem right.

i messed about with a few methods of decreasing speeds as you bank etc but none worked the way i wanted em to, so now im just gonna link to a Zip here with the exe and the sounce in it

I borrowed the skybox code from the Castle sample, as i was testing it with just plain black, but other might not like that... anyway here yas go

http://www.specis.pwp.blueyonder.co.uk/AirFight.zip

anyone any suggests on method of making this seem more "Real"

The Puter currently uses random waypoints in this sample


GfK(Posted 2004) [#2]
What gives with the controls?

[edit] oh i see, i'm not controlling the camera - there's another plane.

Too difficult to see what the computer AI is doing in this setup, IMHO.


Specis(Posted 2004) [#3]
change the camera view then :) 1,2,3, its not the Computer AI your im having problems with, its theres no feeling of hmmmm friction basically as the plane banks, rolls


_PJ_(Posted 2004) [#4]
Ehh can you be little more specific? Is it the camera controls you wish to make more 'realistic' or the AI fighters?

If its the camera, you have two chohices:
1 Realistic : Add in a proper physics engine (dunno if that Tokamak stuff will do this?) and make use of air resistance and coefficients. This will be the most realistic and longer and more difficult to program.

2 Simple but effective: Do what I did for my space project, and have a couple of variables to dampen movement i.e.

dampen# = speed#/topspeed#

TurnEntity Maincam, 0,dampen#*(keydown(203)-keydown(205)),0



^^ Dunno if i got the keydown 203/205 the right way round as Im at work and cannot test it.



Also, you are effectively accelerating at 1/40th the topspeed. 40 loops is extremely quick, so the craft will reach full speed very quickly.

I would at least increase this by a factor of 5

---------

If it's the enemy fighters, use the code for smooth aligning (Im sure it was in archives, cannot find it now, but I have it on my HD at home and can post it later)


_PJ_(Posted 2004) [#5]
; PointSmooth() - example


Graphics3D 640,480


cube=CreateCube()

ScaleMesh cube,1,1,2

EntityColor cube,100,100,100


pivot=CreatePivot()

sphere=CreateSphere( 16,pivot )

PositionEntity sphere,5,0,5


camera=CreateCamera()

PositionEntity camera,0,0,-14


light=CreateLight()

TurnEntity light,45,45,0


While Not KeyHit(1)

 TurnEntity pivot,.5,1,0

 PointEntitySmooth(cube,sphere,1.1,1.1)

 MoveEntity cube,0,0,0.09

 RenderWorld

 Flip

Wend


End


; points an entity towards another smoothly

Function PointEntitySmooth( e1,e2,pitch_speed#,yaw_speed# )

 Local yaw#=EntityYaw(e1)

 Local pitch#=EntityPitch(e1)

 PointEntity e1,e2

 Local d_yaw#=EntityYaw(e1)-yaw#

 Local d_pitch#=EntityPitch(e1)-pitch#

 If d_yaw>=180 d_yaw=d_yaw-360 Else If d_yaw<-180 d_yaw=d_yaw+360

 If d_pitch>=180 d_pitch=d_pitch-360 Else If d_pitch<-180 d_pitch=d_pitch+360

 If d_yaw>yaw_speed d_yaw=yaw_speed Else If d_yaw<-yaw_speed d_yaw=-yaw_speed

 If d_pitch>pitch_speed d_pitch=pitch_speed Else If d_pitch<-pitch_speed d_pitch=-pitch_speed

 RotateEntity e1,pitch+d_pitch,yaw+d_yaw,0

End Function



That's the routines I meant - Apologies I honestly cannot remember who wrote it!