예제 #1
0
    /// <summary>Create this fixture in the simulation with a shape pointer you already have
    /// Note: Used for concave fixtures or fixtures with more than 8 vertices
    /// They are broken up into several fixtures </summary>
    protected override void InitialiseWithShape(IntPtr shape)
    {
        IntPtr fix = LPAPIFixture.AddFixture(body.GetPtr(), (int)Shapetype
                                             , shape
                                             , Density, actualFriction, actualRestitution, IsSensor, myIndex);

        LPAPIFixture.SetFixtureFilterData(fix, (Int16)CollisionGroupIndex, categoryBits, maskBits);

        SubPtrs.Add(fix);
    }
예제 #2
0
    protected override void DoSpawn()
    {
        GameObject ob  = Instantiate(Prefab, transform.position, Quaternion.AngleAxis(Random.Range(0f, 360f), Vector3.back)) as GameObject;
        LPBody     bod = ob.GetComponent <LPBody>();

        bod.Initialise(lpman);
        Vector3 diff = getdiff();

        LPAPIBody.ApplyLinearImpulseToBody(bod.GetPtr(), diff.x, diff.y, ob.transform.position.x, ob.transform.position.y, true);
    }
예제 #3
0
    /// <summary>Create this fixture in the simulation</summary>
    public virtual void Initialise(LPBody bod)
    {
        body    = bod;
        myIndex = body.AddFixture(this);
        GetPhysProps();

        IntPtr shape = GetShape();

        ThingPtr = LPAPIFixture.AddFixture(body.GetPtr(), (int)Shapetype
                                           , shape
                                           , Density, actualFriction, actualRestitution, IsSensor, myIndex);

        LPAPIFixture.SetFixtureFilterData(ThingPtr, (Int16)CollisionGroupIndex, categoryBits, maskBits);
    }
예제 #4
0
 private IEnumerator Spawn()
 {
     while (true)
     {
         if (bodylist.Count > amount)
         {
             bodylist[0].Delete();
             bodylist.RemoveAt(0);
         }
         GameObject go = new GameObject("body");
         go.transform.parent   = transform;
         go.transform.position = transform.position;
         LPBody body = go.AddComponent <LPBody>();
         bodylist.Add(body);
         LPFixtureCircle circle = go.AddComponent <LPFixtureCircle>();
         circle.Density = 0.2f;
         circle.Radius  = 0.1f;
         body.BodyType  = LPBodyTypes.Dynamic;
         body.Initialise(lpman);
         LPAPIBody.ApplyForceToCentreOfBody(body.GetPtr(), SpawnVelocity.x, SpawnVelocity.y);
         yield return(new WaitForSeconds(spawninterval));
     }
 }
예제 #5
0
    /// <summary>Create this fixture in the simulation</summary>								
    public virtual void Initialise(LPBody bod)
    {
        body = bod;
        myIndex = body.AddFixture(this);
        GetPhysProps();

        IntPtr shape = GetShape();

        ThingPtr = LPAPIFixture.AddFixture(body.GetPtr(),(int)Shapetype
                                           ,shape
                                           ,Density,actualFriction,actualRestitution,IsSensor,myIndex);

        LPAPIFixture.SetFixtureFilterData(ThingPtr,(Int16)CollisionGroupIndex,categoryBits,maskBits);
    }