|
-
Jul 28th, 2000, 10:57 PM
#1
Thread Starter
transcendental analytic
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:
Code:
'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.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jul 29th, 2000, 09:55 PM
#2
New Member
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)
If I weren't insane, someone else would be. :-p
Steve
-
Jul 29th, 2000, 09:57 PM
#3
New Member
A better link
If I weren't insane, someone else would be. :-p
Steve
-
Jul 31st, 2000, 08:57 AM
#4
Frenzied Member
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.
Harry.
"From one thing, know ten thousand things."
-
Jul 31st, 2000, 09:00 AM
#5
Frenzied Member
Oh yeah, if you're really going for realism, are you going to take into account spin?
Harry.
"From one thing, know ten thousand things."
-
Jul 31st, 2000, 09:05 AM
#6
Frenzied Member
wow, this is getting complicated. I have no clue how to do it, but maybe rain? That might slow it down. Just a thought
-
Jul 31st, 2000, 09:29 AM
#7
Frenzied Member
the real killer is this, say your missile is in a wind going from right to left, and it's orientated like this.
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.
-
Jul 31st, 2000, 09:42 AM
#8
Fanatic Member
Code:
Projectile.Left = Projectile.Left + 1
I think that'll do.
-
Jul 31st, 2000, 09:56 AM
#9
Thread Starter
transcendental analytic
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
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jul 31st, 2000, 10:03 AM
#10
Thread Starter
transcendental analytic
Code:
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
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jul 31st, 2000, 11:08 AM
#11
New Member
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]).
If I weren't insane, someone else would be. :-p
Steve
-
Jul 31st, 2000, 02:14 PM
#12
Thread Starter
transcendental analytic
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.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 2nd, 2000, 04:45 AM
#13
Fanatic Member
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.
-
Aug 2nd, 2000, 03:29 PM
#14
Thread Starter
transcendental analytic
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:
Code:
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!
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 2nd, 2000, 04:03 PM
#15
Lively Member
what game you makin now kedaman?
-
Aug 2nd, 2000, 04:30 PM
#16
Thread Starter
transcendental analytic
I'm making an RTS called Galactic domination.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|