Beispiel #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);
    }
Beispiel #2
0
    /// <summary>Set the collision filter data for this fixture</summary>
    public void SetFixtureFilterData(Int16 groupIndex, UInt16 categoryBits, UInt16 maskBits)
    {
        LPAPIFixture.SetFixtureFilterData(ThingPtr, groupIndex, categoryBits, maskBits);

        if (SubPtrs != null)
        {
            foreach (IntPtr ptr in SubPtrs)
            {
                LPAPIFixture.SetFixtureFilterData(ptr, groupIndex, categoryBits, maskBits);
            }
        }
    }
Beispiel #3
0
    /// <summary>Delete this fixture. In the simulation and in unity</summary>
    public override void Delete()
    {
        body.RemoveFixture(myIndex);
        LPAPIFixture.DeleteFixture(body.GetPtr(), ThingPtr);
        if (SubPtrs != null)
        {
            foreach (IntPtr fix in SubPtrs)
            {
                LPAPIFixture.DeleteFixture(body.GetPtr(), fix);
            }
        }

        Destroy(this);
    }
Beispiel #4
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);
    }
Beispiel #5
0
    // Use this for initialization
    void Start()
    {
        Debug.Log(LPAPIBody.GetBodyUserData(GetComponent <LPBody>().GetPtr()));

        Debug.Log(LPAPIFixture.GetFixtureUserData(GetComponent <LPFixture>().GetPtr()));
    }