fisica contact "assertion error"

edited January 2014 in Library Questions

why in the fisica library, in any contact function (like contactStarted), if you try to fire a method like setPosition, setRotation or setStatic on a FBody involved in the collision, it always returns "Assertion Error" ? Is there a workaround if for example I want to change the position, rotation or make it static once the contact happens?

for example:

void contactStarted(FContact c) { if (c.contains(myBody)) {
myBody.setStatic(false);
} }

thanks

Answers

  • edited January 2014

    i figured out a workaround where basically I just set a different fill for the body involved in the contact of which I want to setStatic(false), using setFill(0), then I loop trough all the bodies (they are contained in a custom array) and if one of them is black (getFill() == color(0)) then i restore its actual color and setStatic(false) and it works. Funny solution but it works.

Sign In or Register to comment.