PDA

Click to See Complete Forum and Search --> : Realistic Ballistics > for Mathematicians/Physicists


kedaman
Jul 28th, 2000, 10:57 PM
I don't know if there are any real good mathematicians here, but if there are any, i have a qwestion for you.

I wan't to have a calculation algoritm for a ballistics tracks, in other words projectiles that react to friction, friction that is calculated by Wind, the weight of the projectile and the velocity of the projectile. Also i need to attend the target's velocity (to predict where the target will be).


Therefore i have to provide the types i'm using for this case:


'For orientation: Coordinates and vectors
Type Iso2d
x As Single
y As Single
End Type
Type Iso3d
x As Single
y As Single
z As Single
End Type

'The target orientation
Type target
Position As Iso3d
Vector As Iso3d
End Type
'The projectile orientation
Type Projectile
Position As Iso3d
Vector As Iso3d
'Design As Byte 'hAmmoDesign
End Type
'The Weapon orientation
Type Weapon
'Design As Byte 'hWeaponDesign
'Direction As Byte
'target As integer 'htarget
Position as Iso3d
End Type

Type WeaponDesign
'TurretOffset() As PixelCOffset
'Turret() As DirectDrawSurface7
'range As Byte '(the length to which the weapon can reach)
MaxSpeed As Byte
MaxBias As Byte ' (The accurancy of the weapon, the smaller value, the more accurant)
'PrimaryDealy As Byte '(between shots)
'SecondaryDealy As Byte '(between reloadings)
'rounds As Byte '(amount of ammunition before reloading)
'ammunition As Byte 'hAmmoDesign (what type of ammunition is required)
'Weight As Byte ' In kg tblMacrovalue()
Weight As Single
MaxVerticalAngle As Single
'Info As DesignInfo
End Type

'Function InitiateProjectile(hWeapon As Integer) As Integer 'Returns the handle
Function InitiateProjectile(Weapon as Weapon, Target as Target, WeaponDesign as WeaponDesign, Wind as Iso2d) as Projectile
'ReDim Projectile(projectileCount)
'With Projectile(projectileCount)
With InitiateProjectile
'Hmm what to do here?
End With
'projectileCount = projectileCount + 1
End Function


MaxSpeed is the highest speed the initial velocity can be
MaxBias is maximum distance from the calculated target, meaning you add a bias to the target with RND
MaxVerticalAngle is the highest vertical angle the turret can have
Weight is the weight of the projectile

For calculating forces; you can use whatever constants for gravity and friction

So here is everything i can provide, you could ask anything if you don't undestand something.

GKCopperDragon
Jul 29th, 2000, 09:55 PM
Well, if you want to calculate friction, the actual wind speed is not the main part. You need to find out the Co-Efficient of Friction of wind. This is a major varying factor in friction. This may helpa bit if you know how to calculate them. http://www.towson.edu/~leffmann/coeffoffrict.html

The formula for Frictional Forces is:
u = Co-Efficient of Friction (ex. the variation)
Ff = Fricational Force (ex. Of Air)
Fn = Natural Friction (ex. of a missile)

u = (Ff/Fn)

GKCopperDragon
Jul 29th, 2000, 09:57 PM
http://mu.mae.cornell.edu/

HarryW
Jul 31st, 2000, 08:57 AM
The friction of the air isn't like normal friction though, it's drag... if that makes sense. It's to do with fluid dynamics and streamline flow, and I'm fairly sure wind speed will be a factor.

It's been a while since I did fluid dynamics and what I did was more based on fluid pressure than drag.

What I do remember was something like drag is proportional to velocity squared:

d O< vē

(that O< symbol is supposed to be the 'fish' symbol used for 'directly proportional')

I'm not actually sure whether it's proportional or directly proportional, but with either 1 or 2 constants you should be able to sort it out. Mind you it might only be valid for streamline flow, or only for terbulent flow.

Hmm, I don't think I'm being a lot of help here. I've only dealt with friction in Cartesian equations, not vectors, but I'm pretty sure it's not too different.

HarryW
Jul 31st, 2000, 09:00 AM
Oh yeah, if you're really going for realism, are you going to take into account spin? :D

SteveCRM
Jul 31st, 2000, 09:05 AM
wow, this is getting complicated. I have no clue how to do it, but maybe rain? That might slow it down. Just a thought ;)

Sam Finch
Jul 31st, 2000, 09:29 AM
the real killer is this, say your missile is in a wind going from right to left, and it's orientated like this.


/
/
/ <- Wind
/
/


now unter a particle model, even with friction the missile will not rotate in the air, but what actually happens is that there is high air pressure on the right side of the missile, on the left side it's harder for the wind to get over the top than it is to get under it, the resulting wind underneath sucks air from the bottom left of the missile causing it to rotate.

One way of doing it is to assume that the missile is always facing into the airstream, then work out the accelaration due to friction, which is K*(V^2) where K is a constant for friction and V is the speed it's going through the wind

then the accelaration due to gravity = g and add them together (remember they are vectors) then you can either integrate twich wrt Time to get the position it terms of time, or do it numericly, ie work out it's new velocity after the accelaration and then work out its new position.

V(ery) Basic
Jul 31st, 2000, 09:42 AM
Projectile.Left = Projectile.Left + 1


I think that'll do.

kedaman
Jul 31st, 2000, 09:56 AM
Very Basic, that's one of the greatest ideas i could think of.

WEll what i forgot to post was the real qwestion, how do i calculate the Launch Vector, from what i know is

* the target's coordinate
* the target's vector
* the source coordinate
* The Wind&gravity vector
* The Friction constant

kedaman
Jul 31st, 2000, 10:03 AM
Function Vector3Sum(Vector1 As Iso3d, vector2 As Iso3d) As Iso3d
Vector3Sum.x = Vector1.x + vector2.x
Vector3Sum.y = Vector1.y + vector2.y
Vector3Sum.z = Vector1.z + vector2.z
End Function
Function Vector3Prod(Vector As Iso3d, Factor As Single) As Iso3d
Vector3Prod.x = Vector.x * Factor
Vector3Prod.y = Vector.y * Factor
Vector3Prod.z = Vector.z * Factor
End Function

Sub MovePoint(Coordinate As Iso3d, Vector As Iso3d, Friction!)
Vector = Vector3Sum(Vector, GWF) 'Gravity+Wind
Vector = Vector3Prod(Vector, Friction) 'Friction by atmosphere
Coordinate = Vector3Sum(Coordinate, Vector)
End Sub

This is what I have, currently for moving the projectile, but what i need is to calculate the initial velocity, the launch vector for the projectile

GKCopperDragon
Jul 31st, 2000, 11:08 AM
I agree wth the fluid dynamics with the drag... But if you were to make wind its self a direction change factor rather than for that it would only need be for that one. and if its against the wind t would decrease the velocity vector and if it were with it it would increase. So you could make your wind just be a directional modifier, changing the whole vector (Speed Units[Direction]).

kedaman
Jul 31st, 2000, 02:14 PM
rather than for that it would only need be for that one

Not sure what you meant there, but Yes, the wind is as gravity, the acceleration; therefore i included it in the GWF vector (Gravity and Wind Force)as you see above. The friction itself cannot be included as acceleration, since it's one degree above acceleration.

V(ery) Basic
Aug 2nd, 2000, 04:45 AM
I don't know how to put this into VB (I do actually, but I can't be bothered to write it :) ) but:

for every 'bit' the projectile moves you should increase its speed, horizontal direction and vertical direction by x of the wind's speed, horizontal direction and vertical direction. This means that the wind's properties need to be 3D (ie can go up or down, left or right, towards or away) and can be any speed. So if the wind if blowing from behind the projectile, it actually makes it go faster etc.

See what I'm getting at?

Also remember to make the wind calculation function full of Rnds to account for gusts/lulls direction changes (vertical and horizontal) etc.

kedaman
Aug 2nd, 2000, 03:29 PM
Hmm, i thought about the wind and it would make sense that there would be no friction if it moved with the wind, so i guess i was wrong about having wind as just a simple acceleration.

Now i'm adding the difference between the wind and the velocity, to the gravity:

Sub MovePoint(Coordinate As Iso3d, Vector As Iso3d, Friction!)
Vector = VectorSum(VectorSum(Gravity,Vector3Prod(Vector3Diff(Vector, Wind), Friction)),Vector)
Coordinate = Vector3Sum(Coordinate, Vector)
End Sub

I'm almost sure nobody could help me now! :(

Bad5887
Aug 2nd, 2000, 04:03 PM
what game you makin now kedaman?

kedaman
Aug 2nd, 2000, 04:30 PM
I'm making an RTS called Galactic domination.