void CollisionObject2DSW::set_shape_transform(int p_index,const Matrix32& p_transform) { ERR_FAIL_INDEX(p_index,shapes.size()); shapes[p_index].xform=p_transform; shapes[p_index].xform_inv=p_transform.affine_inverse(); _update_shapes(); _shapes_changed(); }
void CollisionObject2DSW::set_shape(int p_index, Shape2DSW *p_shape) { ERR_FAIL_INDEX(p_index, shapes.size()); shapes[p_index].shape->remove_owner(this); shapes[p_index].shape = p_shape; p_shape->add_owner(this); _update_shapes(); _shapes_changed(); }
void CollisionObject2DSW::add_shape(Shape2DSW *p_shape, const Matrix32 &p_transform) { Shape s; s.shape = p_shape; s.xform = p_transform; s.xform_inv = s.xform.affine_inverse(); s.bpid = 0; //needs update s.trigger = false; shapes.push_back(s); p_shape->add_owner(this); _update_shapes(); _shapes_changed(); }
void CollisionObject2DSW::add_shape(Shape2DSW *p_shape, const Transform2D &p_transform) { Shape s; s.shape = p_shape; s.xform = p_transform; s.xform_inv = s.xform.affine_inverse(); s.bpid = 0; //needs update s.disabled = false; s.one_way_collision = false; shapes.push_back(s); p_shape->add_owner(this); _update_shapes(); _shapes_changed(); }
void CollisionObject2DSW::remove_shape(int p_index) { //remove anything from shape to be erased to end, so subindices don't change ERR_FAIL_INDEX(p_index, shapes.size()); for (int i = p_index; i < shapes.size(); i++) { if (shapes[i].bpid == 0) continue; //should never get here with a null owner space->get_broadphase()->remove(shapes[i].bpid); shapes[i].bpid = 0; } shapes[p_index].shape->remove_owner(this); shapes.remove(p_index); _shapes_changed(); }
void CollisionObject2DSW::_shape_changed() { _update_shapes(); _shapes_changed(); }