I have a need to turn objects from static to dynamic and back again at will. During this process, all userdata, velocity vectors, etc., must be retained.
I figured the easiest way to do this was to use those dreaded m_vars (lacking a way to set it manually):
This does the trick - I can toggle them from being static to dynamic and back again, but while things are frozen I can still nudge them and move them around with other objects (though the effect is dampened). Is there a different way I can go about doing this? Anyone know how to make this work?
(edit: changed problem text)
I figured the easiest way to do this was to use those dreaded m_vars (lacking a way to set it manually):
Code:
var b:b2Body = m_world.GetBodyList();
do {
if (b.GetUserData()) {
if (b.GetUserData().getType() == "Type I'm Looking For") {
b.m_type = 1; //static
}
}
} while (b = b.GetNext());
do {
if (b.GetUserData()) {
if (b.GetUserData().getType() == "Type I'm Looking For") {
b.m_type = 1; //static
}
}
} while (b = b.GetNext());
This does the trick - I can toggle them from being static to dynamic and back again, but while things are frozen I can still nudge them and move them around with other objects (though the effect is dampened). Is there a different way I can go about doing this? Anyone know how to make this work?
(edit: changed problem text)