deltaluca / nape

Haxe/AS3 Physics Engine
http://napephys.com
Other
542 stars 77 forks source link

Merge bodies from one space to another #98

Open T1mL3arn opened 8 years ago

T1mL3arn commented 8 years ago
var space1 = new Space();
var space2 = new Space();
var bodies = new BodyList();
bodies.push(new Body());
bodies.push(new Body());
bodies.push(new Body());

space1.bodies.merge(bodies);

// Try to remove bodies from one space and add to another
space2.bodies.merge(space1.bodies/*.copy(false)*/);
trace('space1 bodies: ${space1.bodies.length} ; space2 bodies: ${space2.bodies.length}');

// space1 bodies: 1 ; space2 bodies: 2 without copy();
// space1 bodies: 0 ; space2 bodies: 3 with copy(); - correct out

Also there is no special output with -D NAPE_ASSERT.