restitution

Applying Coefficient of Restitution in a collision resolution method

橙三吉。 提交于 2019-12-11 03:16:15
问题 I have a collision resolution method in my physics engine, that goes like this: Vector2 n1pos = n1.NonLinearSpace != null ? n1.NonLinearPosition : n1.Position; Vector2 n2pos = n2.NonLinearSpace != null ? n2.NonLinearPosition : n2.Position; Vector2 posDiff = n2pos - n1pos; Vector2 posDiffNormal = posDiff; posDiffNormal.Normalize(); float totalRadius = n1.Radius + n2.Radius; float posDiffLength = posDiff.Length(); float interPenetration = totalRadius - posDiffLength; float averageRestitution =

SKPhysicsBody with restitution 0 still bounces

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-07 17:35:25
问题 I'm am trying to drop the SKSpriteNode with constant speed and without bouncing. Here is the code I'm using: SKSpriteNode *floor = [SKSpriteNode spriteNodeWithColor:[UIColor clearColor] size:CGSizeMake(self.size.width, 1)]; floor.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:floor.size]; floor.physicsBody.restitution = 0.0f; floor.physicsBody.dynamic = NO; floor.physicsBody.allowsRotation = NO; SKSpriteNode* block = [SKSpriteNode spriteNodeWithTexture:[SKTexture textureWithImageNamed

SKPhysicsBody with restitution 0 still bounces

一个人想着一个人 提交于 2019-12-05 22:43:10
I'm am trying to drop the SKSpriteNode with constant speed and without bouncing. Here is the code I'm using: SKSpriteNode *floor = [SKSpriteNode spriteNodeWithColor:[UIColor clearColor] size:CGSizeMake(self.size.width, 1)]; floor.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:floor.size]; floor.physicsBody.restitution = 0.0f; floor.physicsBody.dynamic = NO; floor.physicsBody.allowsRotation = NO; SKSpriteNode* block = [SKSpriteNode spriteNodeWithTexture:[SKTexture textureWithImageNamed:imageName]]; block.position = CGPointMake(160, 300); block.physicsBody = [SKPhysicsBody