Page 1 of 1

object affected by air

Posted: Sun Nov 13, 2011 9:57 pm
by sazon
hello again, is there any way I can have an object in my space and this is affected by the air force. want is to pass air force as a vector, can it be?

Re: object affected by air

Posted: Sun Nov 13, 2011 10:01 pm
by Norbo
If you just want to apply wind in the form of a steady force, you could modify the Space.ForceUpdater.Gravity property to include the wind force.

You could also cycle through all entities and apply an impulse to them yourself by using the velocity properties or the ApplyImpulse methods.

If you want to have a wind speed, you could go with the cycle-through-entities approach and compute the velocity in the direction by using a dot product. An entity's linear velocity along a direction is Vector3.Dot(normalizedDirection, entity.LinearVelocity). Compare this to your desired wind speed. Apply a force on the object without accelerating it past your wind speed.