UIKit Dynamics "SolveVelocityConstraints"

When using, UIKit DynamicsI get a crash. This does not happen every time the code is executed, but it happens quite often. Has anyone come across this?

Assertion failed: (a.x >= 0.0f && a.y >= 0.0f), 
function SolveVelocityConstraints, file 
/SourceCache/PhysicsKit/PhysicsKit-
4.6/PhysicsKit/Box2D/Dynamics/Contacts/b2ContactSolver.cpp, line 422.

This is the code that generates the error. I guess this has something to do with the boundaries of the clashes.

UIDynamicAnimator *animator = 
 [[UIDynamicAnimator alloc] initWithReferenceView:self];

UIGravityBehavior *gravityBehavior = 
 [[UIGravityBehavior alloc] initWithItems:@[self.rewardButton]];
gravityBehavior.gravityDirection = CGVectorMake(0.0, 1.0);
gravityBehavior.magnitude = 1.0f;

UICollisionBehavior* collisionBehavior = 
 [[UICollisionBehavior alloc] initWithItems:@[self.rewardButton, 
                                              self.processingView]];
collisionBehavior.collisionDelegate = self;
UIEdgeInsets insets = UIEdgeInsetsMake(-700, 60, 200, 60);
[collisionBehavior setTranslatesReferenceBoundsIntoBoundaryWithInsets:insets];

UIDynamicItemBehavior* propertiesBehavior = 
 [[UIDynamicItemBehavior alloc] initWithItems:@[self.rewardButton]];
float elasticity = arc4random() % 4 * 0.1 + 0.1f;
propertiesBehavior.elasticity = elasticity;

[animator addBehavior:propertiesBehavior];
[animator addBehavior:gravityBehavior];
[animator addBehavior:collisionBehavior];

self.animator = animator;
+4
source share
2 answers

, , , , UIDynamicItemBehavior. 1 2 , 500 . , , , , , .

UIDynamicItemBehavior *itemBehavior = 
 [[UIDynamicItemBehavior alloc] initWithItems:self.items];
[itemBehavior setDensity:500.0f];
[self.animator itemBehavior];

KillerRhino, Box2D, , . UIDynamicItemBehavior . , /.

, A7 (iPhone 5s, iPad Air, iPad Mini Retina). , 64- ?

+1

crasher. , physicalBody . , 0,05. 50 ( 1000), crasher. , , , .

0

All Articles