|
@@ -316,6 +316,13 @@ PhysicsScreenEntity *PhysicsScreen::addCollisionChild(ScreenEntity *newEntity, i
|
|
|
return ret;
|
|
return ret;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+PhysicsScreenEntity *PhysicsScreen::trackCollisionChild(ScreenEntity *newEntity, int entType) {
|
|
|
|
|
+ PhysicsScreenEntity *ret;
|
|
|
|
|
+ ret = trackPhysicsChild(newEntity, entType, false, 0,0.0,0, true);
|
|
|
|
|
+ ret->collisionOnly = true;
|
|
|
|
|
+ return ret;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
void PhysicsScreen::setTransform(ScreenEntity *ent, Vector2 pos, Number angle) {
|
|
void PhysicsScreen::setTransform(ScreenEntity *ent, Vector2 pos, Number angle) {
|
|
|
PhysicsScreenEntity *pEnt = getPhysicsByScreenEntity(ent);
|
|
PhysicsScreenEntity *pEnt = getPhysicsByScreenEntity(ent);
|
|
|
if(pEnt == NULL)
|
|
if(pEnt == NULL)
|
|
@@ -433,6 +440,10 @@ void PhysicsScreen::destroyMouseJoint(b2MouseJoint *mJoint) {
|
|
|
|
|
|
|
|
PhysicsScreenEntity *PhysicsScreen::addPhysicsChild(ScreenEntity *newEntity, int entType, bool isStatic, Number friction, Number density, Number restitution, bool isSensor, bool fixedRotation) {
|
|
PhysicsScreenEntity *PhysicsScreen::addPhysicsChild(ScreenEntity *newEntity, int entType, bool isStatic, Number friction, Number density, Number restitution, bool isSensor, bool fixedRotation) {
|
|
|
addChild(newEntity);
|
|
addChild(newEntity);
|
|
|
|
|
+ return trackPhysicsChild(newEntity, entType, isSensor, friction, density, restitution, isSensor, fixedRotation);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+PhysicsScreenEntity *PhysicsScreen::trackPhysicsChild(ScreenEntity *newEntity, int entType, bool isStatic, Number friction, Number density, Number restitution, bool isSensor, bool fixedRotation) {
|
|
|
newEntity->setPositionMode(ScreenEntity::POSITION_CENTER);
|
|
newEntity->setPositionMode(ScreenEntity::POSITION_CENTER);
|
|
|
PhysicsScreenEntity *newPhysicsEntity = new PhysicsScreenEntity(newEntity, world, worldScale, entType, isStatic, friction, density, restitution, isSensor,fixedRotation);
|
|
PhysicsScreenEntity *newPhysicsEntity = new PhysicsScreenEntity(newEntity, world, worldScale, entType, isStatic, friction, density, restitution, isSensor,fixedRotation);
|
|
|
physicsChildren.push_back(newPhysicsEntity);
|
|
physicsChildren.push_back(newPhysicsEntity);
|
|
@@ -440,6 +451,7 @@ PhysicsScreenEntity *PhysicsScreen::addPhysicsChild(ScreenEntity *newEntity, int
|
|
|
return newPhysicsEntity;
|
|
return newPhysicsEntity;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
void PhysicsScreen::removePhysicsChild(ScreenEntity *entityToRemove) {
|
|
void PhysicsScreen::removePhysicsChild(ScreenEntity *entityToRemove) {
|
|
|
PhysicsScreenEntity *physicsEntityToRemove = getPhysicsByScreenEntity(entityToRemove);
|
|
PhysicsScreenEntity *physicsEntityToRemove = getPhysicsByScreenEntity(entityToRemove);
|
|
|
if(!physicsEntityToRemove) {
|
|
if(!physicsEntityToRemove) {
|