// Rem implements move.World.Rem func (sm *stage) Rem(body move.Body) { for index, b := range sm.bodies { if b.Id() == body.Id() { sm.bodies = append(sm.bodies[:index], sm.bodies[index+1:]...) return } } }
// Part interface implementation. func (p *part) SetBody(body move.Body, mass, bounce float64) { if p.body != nil { p.RemBody() } p.body = body.SetMaterial(mass, bounce) p.body.SetData(p) p.body.World().Loc.Set(p.loc) p.body.World().Rot.Set(p.dir) p.world.Add(p.body) }