Hi Ricardo, thanks a lot for the prompt and detailed replies!
It looks like we'll have to abandon this functionality in the C4D version of the plugin for now. Too bad, since it adds a great deal of flexibility to the simulation.
Any chance you would consider extending the API to allow native C4D objects to act as forces in external dynamics simulations? I don't think this is unreasonable, as I said this is available in both 3ds Max and Maya. Any plugin that does dynamics would absolutely want to have these available.
Thanks a lot for your reply. Unfortunately, I couldn't find anything helpful in the documentation.
Let me explain in more detail.
In abstract terms, I need an object that can can represent a vector field, with the appropriate API allowing to obtain vector values at any point (or set of points) in space.
In practical terms, I need to get the force exerted by, e.g. a Wind object, on a particle at a given world position. This is the wind force that a C4D particle at that position would "feel" when simulated. Is there a public API to get that force? I stress again that the force is normally position-dependent, hence the "parameters" of the Wind are not what I'm looking for. For some force fields (e.g. drag), the force depends on the velocity (again, that of each specific particle); for others (such as gravity) the force would be constant.
The only thing I could find in the documentation that resembles what I am looking for are the functions for sampling a field: FieldObject::Sample() and related. These functions allow getting field values at a set of points in space, which is exactly what I need. However, C4D fields seem to be geometric objects, not directly related to dynamics, and seem designed to represent falloffs rather than vector fields. I will end up using C4D fields if there's nothing else available, but I'd rather let clients use the appropriate C4D tools for particle dynamics. On the other hand, maybe I'm wrong about C4D fields - can they be used to directly influence particle motion?
I am working on a C++ plugin that does particle dynamics simulations. It is not using C4D particles; the simulation engine is different. I am looking for a way to create scene objects that can act as Wind/Gravity/etc. forces for the particles in the simulation; i.e. objects that allow obtaining vector forces for given particle positions/velocities (and possibly masses).
For C4D particles (which, again, I am not using) it seems this can be done with Particle Attractor/Deflector/Gravity/Wind etc. from the Simulate->Particles menu. However I can't find the C++ API to obtain the forces from these objects. I am looking for an analogue to 3ds Max's class ForceField or Maya's MFnField function set. Or maybe there's a different way to do that in C4D?