28-02-2018, 06:09 AM
I created custom class from ObiExternalForce, added my solver. But it does not work. Do you have any idea how to add external force to particular particles?
Code:
using Obi;
using UnityEngine;
public class ObiSnakeExternalForce : ObiExternalForce
{
public float k = 100;
public override void ApplyForcesToActor(ObiActor actor)
{
var force= new Vector4(0, k, 0, 1);
force[3] = 1;//actor.UsesCustomExternalForces ? 1 : 0;
Oni.AddParticleExternalForce(actor.Solver.OniSolver, ref force, actor.particleIndices, actor.particleIndices.Length);
}
}