本文整理汇总了C++中cpBodyActivate函数的典型用法代码示例。如果您正苦于以下问题:C++ cpBodyActivate函数的具体用法?C++ cpBodyActivate怎么用?C++ cpBodyActivate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cpBodyActivate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cpSpaceRemoveConstraint
void
cpSpaceRemoveConstraint(cpSpace *space, cpConstraint *constraint)
{
cpAssertWarn(cpArrayContains(space->constraints, constraint),
"Cannot remove a constraint that was not added to the space. (Removed twice maybe?)");
// cpAssertSpaceUnlocked(space); Should be safe as long as its not from a constraint callback.
cpBodyActivate(constraint->a);
cpBodyActivate(constraint->b);
cpArrayDeleteObj(space->constraints, constraint);
}
示例2: cpSpaceRemoveConstraint
void
cpSpaceRemoveConstraint(cpSpace *space, cpConstraint *constraint)
{
cpAssertHard(cpSpaceContainsConstraint(space, constraint), "Cannot remove a constraint that was not added to the space. (Removed twice maybe?)");
cpAssertSpaceUnlocked(space);
cpBodyActivate(constraint->a);
cpBodyActivate(constraint->b);
cpArrayDeleteObj(space->constraints, constraint);
cpBodyRemoveConstraint(constraint->a, constraint);
cpBodyRemoveConstraint(constraint->b, constraint);
constraint->space = NULL;
}
示例3: cpSpaceAddConstraint
cpConstraint *
cpSpaceAddConstraint(cpSpace *space, cpConstraint *constraint)
{
cpAssert(!cpArrayContains(space->constraints, constraint), "Cannot add the same constraint more than once.");
// cpAssertSpaceUnlocked(space); This should be safe as long as its not from a constraint callback.
if(!constraint->a) constraint->a = &space->staticBody;
if(!constraint->b) constraint->b = &space->staticBody;
cpBodyActivate(constraint->a);
cpBodyActivate(constraint->b);
cpArrayPush(space->constraints, constraint);
return constraint;
}
示例4: internalBodySetMass
static void internalBodySetMass(cpBody *body, cpFloat mass)
{
cpBodyActivate(body);
body->m = mass;
body->m_inv = 1.0f/mass;
//cpAssertSaneBody(body);
}
示例5: cpShapeSetElasticity
void
cpShapeSetElasticity(cpShape *shape, cpFloat elasticity)
{
cpAssertHard(elasticity >= 0.0f, "Elasticity must be positive and non-zero.");
cpBodyActivate(shape->body);
shape->e = elasticity;
}
示例6: cpBodySetMass
void
cpBodySetMass(cpBody *body, cpFloat mass)
{
cpBodyActivate(body);
body->m = mass;
body->m_inv = 1.0f/mass;
}
示例7: cpBodySetMoment
void
cpBodySetMoment(cpBody *body, cpFloat moment)
{
cpBodyActivate(body);
body->i = moment;
body->i_inv = 1.0f/moment;
}
示例8: cpBodyApplyForce
void
cpBodyApplyForce(cpBody *body, cpVect force, cpVect r)
{
cpBodyActivate(body);
body->f = cpvadd(body->f, force);
body->t += cpvcross(r, force);
}
示例9: cpShapeSetFriction
void
cpShapeSetFriction(cpShape *shape, cpFloat friction)
{
cpAssertHard(friction >= 0.0f, "Friction must be postive and non-zero.");
cpBodyActivate(shape->body);
shape->u = friction;
}
示例10: cpBodyResetForces
void
cpBodyResetForces(cpBody *body)
{
cpBodyActivate(body);
body->f = cpvzero;
body->t = 0.0f;
}
示例11: cpBodySetPos
void
cpBodySetPos(cpBody *body, cpVect pos)
{
cpBodyActivate(body);
cpBodyAssertSane(body);
body->p = pos;
}
示例12: cpBodySetAngle
void
cpBodySetAngle(cpBody *body, cpFloat angle)
{
cpBodyActivate(body);
cpBodyAssertSane(body);
setAngle(body, angle);
}
示例13: cpShapeSetMass
void
cpShapeSetMass(cpShape *shape, cpFloat mass){
cpBody *body = shape->body;
cpBodyActivate(body);
shape->massInfo.m = mass;
cpBodyAccumulateMassFromShapes(body);
}
示例14: cpSpaceAddConstraint
cpConstraint *
cpSpaceAddConstraint(cpSpace *space, cpConstraint *constraint)
{
cpAssertSoft(!constraint->space, "This shape is already added to a space and cannot be added to another.");
cpAssertSpaceUnlocked(space);
cpBodyActivate(constraint->a);
cpBodyActivate(constraint->b);
cpArrayPush(space->constraints, constraint);
// Push onto the heads of the bodies' constraint lists
cpBody *a = constraint->a, *b = constraint->b;
constraint->next_a = a->constraintList; a->constraintList = constraint;
constraint->next_b = b->constraintList; b->constraintList = constraint;
constraint->space = space;
return constraint;
}
示例15: cpBodySleep
void PhysicsBody::setResting(bool rest) const
{
if (rest && !isResting())
{
cpBodySleep(_info->getBody());
}else if(!rest && isResting())
{
cpBodyActivate(_info->getBody());
}
}