PDA

View Full Version : outline.collision test error



spider853
12-19-2012, 04:11 PM
Hi,
I have a character outline and a self made box outline,
I want to check collision between them with generating collision info like normal and penetration depth.
the problem is that on outline.collision an assert error is thrown, I've tracked it down and its on penetration depth calculation, it finds uneven points and crash the app when trying to get the line information that is out of vector range.

the box is calculated like so:


CL_Contour contour;
contour.get_points().push_back( CL_Pointf(150.0f,50.0f) );
contour.get_points().push_back( CL_Pointf(150.0f,150.0f) );
contour.get_points().push_back( CL_Pointf(300.0f,150.0f) );
contour.get_points().push_back( CL_Pointf(300.0f,50.0f) );
outline.get_contours().push_back(contour);
outline.calculate_radius();
outline.calculate_sub_circles();


the charoutline is from a png file.
I'm also using set_aligment and set_translation for charoutline

Here is the source: 1305

spider853
12-19-2012, 05:31 PM
Seems to work if I enable metadata

rombust
12-20-2012, 08:48 AM
CL_Contour contour;
contour.get_points().push_back( CL_Pointf(150.0f,50.0f) );

That looks like unexpected usage. I have not checked the internals to see if that is safe.

Ideally contour should contain: contour.add_point(const CL_Pointf &point);
And the get_points() should only return a const reference.