Exemple #1
0
        /// <summary>
        /// Clones the fixture and attached shape onto the specified body.
        /// </summary>
        /// <param name="body">The body you wish to clone the fixture onto.</param>
        /// <returns>The cloned fixture.</returns>
        public Fixture cloneOnto(Body body)
        {
            var fixture = new Fixture();

            fixture.body                 = body;
            fixture.shape                = shape.clone();
            fixture.userData             = userData;
            fixture.restitution          = restitution;
            fixture.friction             = friction;
            fixture.isSensor             = isSensor;
            fixture._collisionGroup      = _collisionGroup;
            fixture._collisionCategories = _collisionCategories;
            fixture._collidesWith        = _collidesWith;
            fixture.ignoreCCDWith        = ignoreCCDWith;

            foreach (int ignore in _collisionIgnores)
            {
                fixture._collisionIgnores.Add(ignore);
            }

            fixture.registerFixture();
            return(fixture);
        }