Gravity Engine 12.0
Unity Asset for Gravity
Loading...
Searching...
No Matches
CustomForce Class Reference

Custom force. Sample code to show how to make a custom force. To use this set the GE force delegate to custom and attach this script to the object holding the GravityEngine. More...

Inheritance diagram for CustomForce:
IForceDelegate

Public Member Functions

double CalcPseudoForce (double r_sep, int i, int j, GravityState.NbodyState[] nbodyStates)
 acceleration = a * ln(b * r)
 
double CalcPseudoForceDot (double r_sep, int i, int j, GravityState.NbodyState[] nbodyStates)
 
double[] CalcAccelerationIJPerM (double[] rji, int i, int j, GravityState.NbodyState[] nbodyStates)
 Calculate the acceleration between bodies i and j.
 
double[] CalcAccelerationIPerParticle (double[] rji, int i, GravityState.NbodyState[] nbodyStates)
 
double[] CalcJerkIJPerM (double[] rji, int i, int j, GravityState.NbodyState[] nbodyStates)
 
double[] CalcAccelerationIJPerM (double[] rji, int i, int j, GravityState.NbodyState[] nbodyStates)
 Calculate the acceleration between bodies i and j.
 
double[] CalcAccelerationIPerParticle (double[] rji, int i, GravityState.NbodyState[] nbodyStates)
 
double[] CalcJerkIJPerM (double[] rji, int i, int j, GravityState.NbodyState[] nbodyStates)
 

Public Attributes

float a = 2.0f
 
float b = 1.0f
 

Detailed Description

Custom force. Sample code to show how to make a custom force. To use this set the GE force delegate to custom and attach this script to the object holding the GravityEngine.

Member Function Documentation

◆ CalcAccelerationIJPerM()

double[] CustomForce.CalcAccelerationIJPerM ( double[]  rji,
int  i,
int  j,
GravityState.NbodyState[]  nbodyStates 
)

Calculate the acceleration between bodies i and j.

Return the aij and aji accelerations because in some case (e.g one is oblate) they will not be equal and opposite!

Parameters
rji
i
j
nbodyStates
Returns

Implements IForceDelegate.

◆ CalcAccelerationIPerParticle()

double[] CustomForce.CalcAccelerationIPerParticle ( double[]  rji,
int  i,
GravityState::NbodyState[]  nbodyStates 
)

Implements IForceDelegate.

◆ CalcJerkIJPerM()

double[] CustomForce.CalcJerkIJPerM ( double[]  rji,
int  i,
int  j,
GravityState::NbodyState[]  nbodyStates 
)

Implements IForceDelegate.

◆ CalcPseudoForce()

double CustomForce.CalcPseudoForce ( double  r_sep,
int  i,
int  j,
GravityState::NbodyState[]  nbodyStates 
)

acceleration = a * ln(b * r)

Returns
The accel.
Parameters
r_sepR sep. The distance between the bodies
iindex of one pair in force (i < j)
jindex of second pair in force

The documentation for this class was generated from the following file: