Ejemplo n.º 1
0
/*
 * Chipmunk2d::SlideJoint#max=(max)
 * @param [Float] max
 */
static mrb_value
slide_joint_set_max(mrb_state* mrb, mrb_value self)
{
  cpConstraint* constraint;
  mrb_float mx;
  mrb_get_args(mrb, "f", &mx);
  Data_Get_Struct(mrb, self, &mrb_cp_constraint_type, constraint);
  cpSlideJointSetMax(constraint, (cpFloat)mx);
  return mrb_nil_value();
}
Ejemplo n.º 2
0
static void
update(cpSpace *space, double dt)
{
	// Set the first anchor point (the one attached to the static body) of the dolly servo to the mouse's x position.
	cpPivotJointSetAnchorA(dollyServo, cpv(ChipmunkDemoMouse.x, 100));
	
	// Set the max length of the winch servo to match the mouse's height.
	cpSlideJointSetMax(winchServo, cpfmax(100 - ChipmunkDemoMouse.y, 50));
	
	if(hookJoint && ChipmunkDemoRightClick){
		cpSpaceRemoveConstraint(space, hookJoint);
		cpConstraintFree(hookJoint);
		hookJoint = NULL;
	}
	
	cpSpaceStep(space, dt);
}
Ejemplo n.º 3
0
static void
update(int ticks)
{
	int steps = 1;
	cpFloat dt = 1.0f/60.0f/(cpFloat)steps;
	
	for(int i=0; i<steps; i++){
		// Set the first anchor point (the one attached to the static body) of the dolly servo to the mouse's x position.
		cpPivotJointSetAnchr1(dollyServo, cpv(ChipmunkDemoMouse.x, 100));
		
		// Set the max length of the winch servo to match the mouse's height.
		cpSlideJointSetMax(winchServo, cpfmax(100 - ChipmunkDemoMouse.y, 50));
		
		if(hookJoint && ChipmunkDemoKeyboard.y < 0){
			cpSpaceRemoveConstraint(space, hookJoint);
			cpConstraintFree(hookJoint);
			hookJoint = NULL;
		}
		
		cpSpaceStep(space, dt);
	}
}
Ejemplo n.º 4
0
void PhysicsJointLimit::setMax(float max)
{
    cpSlideJointSetMax(_cpConstraints.front(), PhysicsHelper::float2cpfloat(max));
}
void PhysicsJointLimit::setMax(float max)
{
    cpSlideJointSetMax(m_pInfo->getJoints().front(), PhysicsHelper::float2cpfloat(max));
}
Ejemplo n.º 6
0
void CCSlideJoint::setMax(cpFloat max)
{
	cpSlideJointSetMax(this->m_constraint, max);
}