如何在与physicsBody碰撞后保留SKSpriteNode速度?

时间:2022-11-24 18:53:12

In my game i don't want to decrease velocity of my SKSpriteNode after collision with any physicsBody.

在我的游戏中,我不想在与任何physicsBody碰撞后降低我的SKSpriteNode的速度。

Currently velocity of my SKSpriteNode is decresing very much after collision with physicsBody.

目前我的SKSpriteNode的速度在与physicsBody碰撞后非常低。

What did i tried :

我尝试了什么:

I tried to get velocity in -(void)update:(CFTimeInterval)currentTime method & i provide it to my SKSpriteNode in below method :

我试图获得速度 - (void)更新:(CFTimeInterval)currentTime方法&我在下面的方法中将它提供给我的SKSpriteNode:

-(void)didBeginContact:(SKPhysicsContact *)contact

But it doesn't make any difference.

但它没有任何区别。

Please help me regarding this.

请帮我解决这个问题。

1 个解决方案

#1


Restitution basically equates to an object's "bounciness".

恢复原则基本上等同于对象的“弹性”。

Sprite Kit Physicsbody Restitution is defined as

Sprite Kit Physicsbody Restitution定义为

Property describing how much energy a body retains when it bounces off of another body, basically a fancy way of saying "bounciness"" -IOS Games by Tutorials*

描述身体从另一个身体反弹时保留多少能量的属性,基本上是一种说“蹦蹦”的奇特方式“-IOS Games by Tutorials *

So make self.physicsBody.restitution = 1.0;

所以make self.physicsBody.restitution = 1.0;

Refer Restitution

#1


Restitution basically equates to an object's "bounciness".

恢复原则基本上等同于对象的“弹性”。

Sprite Kit Physicsbody Restitution is defined as

Sprite Kit Physicsbody Restitution定义为

Property describing how much energy a body retains when it bounces off of another body, basically a fancy way of saying "bounciness"" -IOS Games by Tutorials*

描述身体从另一个身体反弹时保留多少能量的属性,基本上是一种说“蹦蹦”的奇特方式“-IOS Games by Tutorials *

So make self.physicsBody.restitution = 1.0;

所以make self.physicsBody.restitution = 1.0;

Refer Restitution