Class ForceField

3DS Max Plug-In SDK

Class ForceField

See Also: Class Point3, Class WSMObject.

class ForceField

Description:

A Space Warp modifier usually uses an instance of this class and implements the Force() method. The force field is then applied to the particle system when the particle system is bound to the Space Warp. This class is similar in some respects to the Deformer class as used by a modifier. The difference is that a deformer modifies the points of the object. A force field is really an acceleration - it modifies velocity rather than position.

The force field provides a function of position in space, velocity and time that gives a force. The force is then used to compute an acceleration on a particle which modifies its velocity. Typically, particles are assumed to have a normalized uniform mass equal to 1 so the acceleration is F/M = F.

Methods:

Prototype:

virtual Point3 Force(TimeValue t, const Point3 &pos, const Point3 &vel, int index)=0;

Remarks:

Implemented by the Plug-In.

This method is called to compute a force on the particle based on its position, velocity and the current time.

Parameters:

TimeValue t

The time to compute the force.

const Point3 &pos

The current position of the particle.

const Point3 &vel

The current velocity of the particle.

int index

This parameter is available in release 2.0 and later only.

The index of the particle being forced.

Return Value:

The force vector as a Point3. This vector is added to the velocity.

Prototype:

virtual void DeleteThis();

Remarks:

This method is available in release 2.0 and later only.

This method is callled to delete this instance of the ForceField. This should be called, for example, by developers who use the WSMObject::GetForceField() method.

Default Implementation:

{}