'GravitationalField' - How do I get the field to ignore?
Posted: Fri Jun 01, 2012 9:52 am
I have an entity associated with a GravitationalField class. This means that I have a kinematic or dynamic model that denotes the origin of the field.
The entity is there so it can be interacted with via a GUI. The position of the GravitationalField is always at the centroid of the associated entity.
How can I get the GravitationalField class to ignore the dynamic entity associated with it in the GravitationalFieldPrimitive class?
This is not normally a problem if the associated entity is kinematic but it needs to be ignored when the associated entity is dynamic.
The entity is there so it can be interacted with via a GUI. The position of the GravitationalField is always at the centroid of the associated entity.
Code: Select all
public GravitationalFieldPrimitive(Game1 game, GravitationalFieldPrimitiveSettings settings)
: base(game, settings = settings == null ? new GravitationalFieldPrimitiveSettings() : settings)
{
// Higher multiplier = Higher gravity (stronger attractive force)
// Maximum value for 'MaxAcceleration' should be 50
// Object shaking occurs after the max value unless the 'space.TimeStepSettings.TimeStepDuration' value is decreased
gravField = new GravitationalField(
new InfiniteForceFieldShape(),
settings.Position,
settings.GravitationalFieldStrength,
50
);
// Force entities in range to wake up
gravField.ForceWakeUp = true;
game.Space.Add(gravField);
}
This is not normally a problem if the associated entity is kinematic but it needs to be ignored when the associated entity is dynamic.