/// <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) { Fixture fixture = new Fixture(); fixture.Body = body; fixture.Shape = Shape.Clone(); fixture.UserData = UserData; fixture.UserInt = UserInt; fixture.UserFloat = UserFloat; 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); }
public Fixture Clone(Body body) { Fixture fixture = new Fixture(); fixture.Body = body; fixture.Shape = this.Shape.Clone(); fixture.UserData = this.UserData; fixture.Restitution = this.Restitution; fixture.Friction = this.Friction; fixture.IsSensor = this.IsSensor; fixture._collisionGroup = this.CollisionGroup; fixture._collisionCategories = this.CollisionCategories; fixture._collidesWith = this.CollidesWith; if (this._collisionIgnores != null) { fixture._collisionIgnores = new Dictionary <int, bool>(); foreach (KeyValuePair <int, bool> pair in this._collisionIgnores) { fixture._collisionIgnores.Add(pair.Key, pair.Value); } } fixture.RegisterFixture(); return(fixture); }
public Fixture Clone(Body body) { Fixture fixture = new Fixture(); fixture.Body = body; //if (Settings.ConserveMemory) // fixture.Shape = Shape; //else fixture.Shape = Shape.Clone(); fixture.UserData = UserData; fixture.UserBits = UserBits; fixture.Restitution = Restitution; fixture.Friction = Friction; fixture.IsSensor = IsSensor; fixture._collisionGroup = CollisionGroup; fixture._collisionCategories = CollisionCategories; fixture._collidesWith = CollidesWith; if (_collisionIgnores != null) { fixture._collisionIgnores = new Dictionary <int, bool>(); foreach (KeyValuePair <int, bool> pair in _collisionIgnores) { fixture._collisionIgnores.Add(pair.Key, pair.Value); } } fixture.RegisterFixture(); return(fixture); }
public Fixture Clone(Body body) { Fixture fixture = new Fixture(); fixture.Body = body; if (Settings.ConserveMemory) fixture.Shape = Shape; else 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; if (_collisionIgnores != null) { fixture._collisionIgnores = new Dictionary<int, bool>(); foreach (KeyValuePair<int, bool> pair in _collisionIgnores) { fixture._collisionIgnores.Add(pair.Key, pair.Value); } } fixture.RegisterFixture(); return fixture; }