public static void AddRadialSphereForce(Vector3 pos, float radius, float strength) { Matrix4x4 mat = Matrix4x4.TRS(pos, Quaternion.identity, Vector3.one * radius); MPForceProperties p = new MPForceProperties(); p.shape_type = MPForceShape.Sphere; p.dir_type = MPForceDirection.Radial; p.radial_center = pos; p.strength_near = strength; p.strength_far = 0.0f; p.attenuation_exp = 0.5f; p.range_inner = 0.0f; p.range_outer = radius; MPAPI.mpAddForce(ref p, ref mat); }
[DllImport("MassParticle")] public static extern void mpAddForce(int context, ref MPForceProperties props, ref Matrix4x4 mat);
public static void AddRadialSphereForce(MPWorld world, Vector3 pos, float radius, float strength) { Matrix4x4 mat = Matrix4x4.TRS(pos, Quaternion.identity, Vector3.one * radius); MPForceProperties p = new MPForceProperties(); p.shape_type = MPForceShape.Sphere; p.dir_type = MPForceDirection.Radial; p.center = pos; p.strength_near = strength; p.strength_far = 0.0f; p.attenuation_exp = 0.5f; p.range_inner = 0.0f; p.range_outer = radius; world.AddOneTimeAction(() => { MPAPI.mpAddForce(world.GetContext(), ref p, ref mat); }); }
public static extern void mpAddForce(int context, ref MPForceProperties props, ref Matrix4x4 mat);
[DllImport("MassParticle")] public static extern void mpAddForce(ref MPForceProperties regionType, ref Matrix4x4 regionMat);