Example #1
0
        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);
            });
        }
Example #2
0
 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);
     });
 }
Example #3
0
 public static int GetCurrentContext()
 {
     return(s_current.GetContext());
 }