Saturday, 15 August 2015

cocos2d iphone - Apply impulse working on x axis but not on y axis -


First of all, a bit of background. I am using cocos 2d with a purpose casing for the chipmunk as a physics engine. I have a physical node called Action node. On ActionNode, I have a physics body, called running fax. Action node and runningfox are scrolled in opposite directions to give an idea of ​​endless runners. It is done in this update method:

  - (zero) update: (CCTEM Delta {runningFox position = CCP (runningFox.position.x + ActionNodeScroll Speed ​​* Delta, running fox.position.y); ActionNode.position = CCP (Action node. Position.x-action nodescroll speed * delta, action node.mO.c.}  

When I'm getting swiped I'm just running the CCActionJumpBy action Now when it is in the air and swipe is done, then I need it to come back faster on the ground, because it is in opposition to normal landing, which is automatically controlled by gravity .When it was a good deal The reason for this purpose can be argued is to try this method:

  [runningFox.physicsBody implementedIpply: local point on CCP (0, 300): CCP (0.5, 0.5)];  

But I have not seen any effect. But if I change x and y values ​​like this

  [runningFox.physicsBody applyImpulse: CCP (300 , 0) local point: CCP (0.5, 0.5)];  

The body is further compelled, therefore for some reason the impulse applies to the X axis, but not on the y axis. Or do I have to be I'm wrong?

honest, I have read the documentation and do not mean the arguments for that method. Therefore, I'm not 100% sure what I want


No comments:

Post a Comment