2D Capsule Collider OR 2 Sphere Colliders / 2 Box Colliders


Currently i need a 2D TS capsule collider. I can make a capsule with the Polygonal one but it seems unneeded.

I tried to add 2 TS 2D Sphere colliders to the top and bottom of the player and 2 box colliders to each side to make a capsule, but it seems having more than 1 collider on a player breaks all collision and the colliders get strwen across the map and only the 1st one detected moves with the character.

Any help with this will be appreciated!


  • Gage_IAG
    Any activity on TrueSync forums?
  • Xelnath
    I ended up creating my own in 2d by creating a Body which custom fixtures (sphere, rect, sphere) attached after it starts up.
  • Gage_IAG
    I tried doing this as well but it seems only the 1st collider moves with the character the rest ar offset in the map and start there and dont follow the player transform. Quite unusual behavior and is really limiting if thats the intended functinality to only have 1 collision component on a character.
  • JeffersonHenrique
    Hello @Gage_IAG, we don't support yet multiple colliders in the same body, I know this not ideal. I thought about two options to you:

    1 - You can use parenting, if you have a parent with a collider all colliders children will move along with it.
    2 - We use internally the Farseer physics for 2D, you could try to adjust it for your needs.
  • Gage_IAG
    @JeffersonHenrique Thank you for the response. I do remember having the children objects with collision but objects still passed through and only reacted to the parents collision. Ill try again to re confirm.
  • Xelnath
    The object *will* move with the body if you set it up correctly...

    var currentPosition = transform.position.ToTSVector2();
    var spherePosition = currentPosition + CircleOffset;
    var world = Physics2DWorldManager.instance.GetWorld() as TrueSync.Physics2D.World;
    body = TrueSync.Physics2D.BodyFactory.CreateBody(world, spherePosition, FP.Zero);
    Physics2DWorldManager.instance.gameObjectMap[body] = gameObject;

    body.BodyType = TrueSync.Physics2D.BodyType.Dynamic;
    body.FixedRotation = true;
    body.Mass = 1.0f;
    body.TSLinearDrag = 0.0f;
    body.TSAngularDrag = 0.05f;
    body.IgnoreGravity = true;
    body.GravityScale = 0f;
    body.GameObjectName = this.gameObject.ToString();
    body.CollidesWith = TrueSync.Physics2D.Category.All;

    radius = width * FP.Half;
    circle = new TrueSync.Physics2D.CircleShape(radius, FP.One);
    circleFixture = body.CreateFixture(circle);

    if ( height > width || (Data_Unit && Data_Unit.Flying == false ) )
    TrueSync.Physics2D.Vertices verts = TrueSync.Physics2D.PolygonTools.CreateRectangle(width * FP.Half, height * FP.Half);

    // Shift the box up a bit so it rests on the sphere
    TSVector2 offset = new TSVector2(0f, height * FP.Half);
    for ( int i = 0; i < verts.Count; i++)
    verts[i] = verts[i] + offset;
    box = new TrueSync.Physics2D.PolygonShape(verts, FP.One);
    boxFixture = body.CreateFixture(box);

    // Update

    Good luck!