Hello, I'm using DP to simulate a projectile in my game, and I would like to simulate a wind effect. If I apply a linear force to the projectile, rather than bend towards the direction the wind is moving, it just heads the same direction as the wind. (Without any bending) If I apply a linear momentum force, the same happens. If I apply angular force/momentum the projectile just stops in mid air and no longer moves.
What am I doing wrong!?
I use this method to apply the initial force to start the projectile moving:
Shot.Velocity# = 10.0
Wind.Strength# = 0.0
Wind.Force# = 2.0 * 250.0 : `the 2.0 is based on the dynamic skybox blend values, the 250.0 is a multiplier.
Make Object Sphere Obj, 20
Position Object Obj, Shot.StartX#, Shot.StartY#, Shot.StartZ#
YRotate Object Obj, Shot.Heading#
XRotate Object Obj, Shot.Elevation#
Move Object Obj, Shot.Velocity#
XVec# = Shot.StartX# - Object Position X( Obj )
YVec# = Shot.StartY# - Object Position Y( Obj )
ZVec# = Shot.StartZ# - Object Position Z( Obj )
Phy Make Rigid Body Dynamic Sphere Obj
Phy Set Rigid Body Linear Velocity Obj, XVec# * Shot.Velocity#, YVec# * Shot.Velocity#, ZVec# * Shot.Velocity#
And this is what I'm using to apply the wind force:
Wind.Strength# = Clamp#( Wind.Strength# + ( ( Wind.Force# / 250.0 ) * TimeChange# ), 0.0, 500.0 )
X# = Wind.Strength# * Sin( Wind.Direction# ) : Z# = Wind.Strength# * Cos( Wind.Direction# )
Phy Set Rigid Body Linear Momentum PhysXRock( Id ), X#, 0.0, Z#
I live for video games! (And beers, and football, and cars!)
See what I live for here: [url]http:\\www.TeamDefiant.co.uk[/url]