Skip to content

Assertion failure with Hash Space with a lot of geoms #93

Description

@BenCheung0422

Describe the bug
I am not sure whether this is expected, but assertion "i >= 0 && (sizeint)i < (tested_rowsize*n)" failed in collision_space.cpp:566.

To Reproduce
Not sure whether this is the minimal case, but this was the case when I faced this error. Although the reproduction code is in Rust, mostly those are just simple helpers and wrappers.

let handle = OdeHandle::new();
let world = handle.create_world();
let space = OdeSpace::new_hash(None, 4, 12);
let mut cm = OdeContactManager::new();
let mut body = world.new_body({
	let mut mass = OdeMass::new();
	mass.set_sphere_total(1.0, 0.5);
	mass
});
body.add_force(10.0, 2.0, 0.0);
let geom = OdeSphere::new(Some(&space), 0.5);
geom.set_body(&body);
body.set_position(0.0, 0.0, 0.0);
let box_space = OdeSpace::new_hash(Some(&space), 4, 12);
cm.omit_space(&box_space);
let mut geoms = Vec::with_capacity(81 * 81 * 81);
for x in -40..=40 {
	for z in -40..=40 {
		for y in -40..=40 {
			if !(x > -2 && x < 2 && y > -2 && y < 2 && z > -2 && z < 2) {
				let mut geom = OdeBox::new(Some(&box_space), DVec3::new(1.0, 1.0, 1.0));
				geom.set_position(x as _, y as _, z as _);
				geoms.push(geom);
			}
		}
	}
}
loop {
	world.step(1.0 / TICK_FREQUENCY);
	space.collide(&mut cm);
	sleep(Duration::from_millis((1.0 / TICK_FREQUENCY * 1000.0) as _))
}

I am using 0.16.6 branch.

Expected behavior
This error does not occur, but not sure whether this is a good usage of this library.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions