Force items all derive from a common type, a type of locator. Being a locator type means all forces have a location, which seems fairly reasonable. All forces implicitly support enable/disable, strength and inversion.
An item inheriting from this type writes a basic force object to the ‘forceObj’ channel. This is then overridden by the core implementation for the default behaviors. This includes a falloff on the force effect which can be set with a graph link.
The force interface allows clients to compute forces from positions and other element features.
Get flag bits describing the force. A force can require velocity or mass as an input, and can optionally generate angular forces.
Force(LXtObjectID self, const LXtFVector pos, LXtFVector force)¶
These single point methods are optimized for computing a force for a single element. Any given force only needs to implement one of these based on the flags above. The client is required to call the right API.
ForceV(LXtObjectID self, const LXtFVector pos, const LXtFVector velocity, LXtFVector force)¶
ForceVM(LXtObjectID self, const LXtFVector pos, const LXtFVector velocity, float mass, LXtFVector force)¶
ForceRun(LXtObjectID self, const float **pos, const float **velocity, const float *mass, float **force, unsigned num)¶
Computing forces over multiple elements is more efficiently done using runs which are arrays of floats. Anything not requested by the flags will be unset. Angular forces can only be computed in runs.