void PhysicsBody::resetForces() { cpBodyResetForces(_info->getBody()); // if _gravityEnable is false, add a reverse of gravity force to body if (_world != nullptr && !_gravityEnable) { applyForce(-_world->getGravity() * _mass); } }
void PhysicsBody::resetForces() { cpBodyResetForces(_info->getBody()); // if _gravityEnabled is false, add a reverse of gravity force to body if (_world != nullptr && _dynamic && !_gravityEnabled && _mass != PHYSICS_INFINITY) { applyForce(-_world->getGravity() * _mass); } }
void CDynamics2DMultiBodyObjectModel::Reset() { /* Reset body position */ MoveTo(GetEmbodiedEntity().GetOriginAnchor().Position, GetEmbodiedEntity().GetOriginAnchor().Orientation); /* For each body: */ for(size_t i = 0; i < m_vecBodies.size(); ++i) { /* Zero the speeds */ m_vecBodies[i].Body->v = cpvzero; m_vecBodies[i].Body->w = 0.0f; /* Zero forces and torques */ cpBodyResetForces(m_vecBodies[i].Body); } }
void CDynamics2DCylinderEntity::Reset() { if(m_ptBody != NULL) { /* Reset body position */ const CVector3& cPosition = GetEmbodiedEntity().GetInitPosition(); m_ptBody->p = cpv(cPosition.GetX(), cPosition.GetY()); /* Reset body orientation */ CRadians cXAngle, cYAngle, cZAngle; GetEmbodiedEntity().GetInitOrientation().ToEulerAngles(cZAngle, cYAngle, cXAngle); cpBodySetAngle(m_ptBody, cZAngle.GetValue()); /* Zero speed and applied forces */ m_ptBody->v = cpvzero; m_ptBody->w = 0.0f; cpBodyResetForces(m_ptBody); } }
static void pullObjectFromPalette(cpShape *shape) { domino_t **dom; cpBody *body; palette_object_t *palObj; palObj = (palette_object_t *)shape->data; g_Dominoes[dominoIndex] = createDomino(atlMouseClickPos(), palObj); dom = &g_Dominoes[dominoIndex++]; (*dom)->my_index = dominoIndex-1; body = (*dom)->body; cpBodyResetForces(body); cpBodySetMoment(body, INFINITY); body->w_limit = 0.0f; grabObject(body); }
void CDynamics2DSingleBodyObjectModel::Reset() { /* Nothing to do for a static body */ if(cpBodyIsStatic(m_ptBody)) return; /* Reset body position */ const CVector3& cPosition = GetEmbodiedEntity().GetOriginAnchor().Position; m_ptBody->p = cpv(cPosition.GetX(), cPosition.GetY()); /* Reset body orientation */ CRadians cXAngle, cYAngle, cZAngle; GetEmbodiedEntity().GetOriginAnchor().Orientation.ToEulerAngles(cZAngle, cYAngle, cXAngle); cpBodySetAngle(m_ptBody, cZAngle.GetValue()); /* Zero speed and applied forces */ m_ptBody->v = cpvzero; m_ptBody->w = 0.0f; cpBodyResetForces(m_ptBody); /* Update bounding box */ cpSpaceReindexShapesForBody(GetDynamics2DEngine().GetPhysicsSpace(), m_ptBody); CalculateBoundingBox(); }
void initializeEditor(void) { int i; cpArray *bodies; cpBody *pb; cpPolyShape *ps; domino_t *dom; editorBody = cpBodyNew(INFINITY, INFINITY); editorBody->p = cpvzero; cpSpaceAddBody(g_Space, editorBody); /* Add collision handler so picking dominoes from the palette doesn't cause * weird collisions from the domino overlapping the palette */ addIgnoredCollisionHandler(g_Space, DOMINO_OBJECT_TYPE, PALETTE_TYPE); loadEditorPalette(); pb = NULL; bodies = g_Space->bodies; /* lock all bodies */ for (i = 0; i < bodies->num; ++i) { pb = (cpBody *)bodies->arr[i]; cpBodyResetForces(pb); cpBodySetMoment(pb, INFINITY); pb->w_limit = 0.0f; } /* add control points to dominoes */ for (i = 0; i < MAX_DOMINOES; ++i) { dom = g_Dominoes[i]; if (dom) { ps = (cpPolyShape *)dom->shape; addControlPointsToDomino(&dom); } } addIgnoredCollisionHandler(g_Space, CONTROL_POINT_TYPE, DOMINO_OBJECT_TYPE); addIgnoredCollisionHandler(g_Space, CONTROL_POINT_TYPE, CONTROL_POINT_TYPE); addIgnoredCollisionHandler(g_Space, CONTROL_POINT_TYPE, PLATFORM_TYPE); }
void cBody::ResetForces() { cpBodyResetForces( mBody ); }
void fff::kitty::Reset(){ rightimpulse = false; leftimpulse = false; cpBodyResetForces(body); }
void PhysicsBody::resetForces() { cpBodyResetForces(_cpBody); }
//Tällä resetoidaan runkoihin kohdistuvat voimat void resetBodyForces(cpBody *body, void *data) { //Vaatii pieniä tarkistuksia, koska muuten nukkuminen ei toimisi if ((body->f.x != 0) || (body->f.y != 0) || (body->t != 0)) cpBodyResetForces(body); }
static VALUE rb_cpBodyResetForces(VALUE self) { cpBodyResetForces(BODY(self)); return self; }
static int cpBody_resetForces (lua_State *L){ cpBody *b = check_cpBody(L, 1); cpBodyResetForces(b); return 0; }
void physics_reset_forces(Entity ent) { PhysicsInfo *info = entitypool_get(pool, ent); error_assert(info); cpBodyResetForces(info->body); }
void Body::resetForces() { cpBodyResetForces(body); }