I am setting up an SKNode as follows:
- (id)init { self = [super init]; if (self) { SKTextureAtlas *atlas = [SKTextureAtlas atlasNamed:@"Sprites"]; SKSpriteNode *spriteNode = [SKSpriteNode spriteNodeWithTexture:[atlas textureNamed:@"Cat"]]; [self addChild:spriteNode]; // Create particle trail SKEmitterNode *emitterNode = [NSKeyedUnarchiver unarchiveObjectWithFile:[[NSBundle mainBundle] pathForResource:@"Hearts" ofType:@"sks"]]; emitterNode.position = CGPointMake(0, 20); [self insertChild:emitterNode atIndex:0]; // Setting up the physics self.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:spriteNode.frame.size]; self.physicsBody.dynamic = YES; self.physicsBody.affectedByGravity = NO; } return self; } When this node moves around horizontally along the X-axis, the source of the particle trail moves along with it, which is expected. What is not expected is that emitted particles do this as well, when instead I expect them to move straight up along the Y-axis from their original X position.
Is there a way to prevent this behaviour?
Creation (in scene):
SPAPlayer *player = [[SPAPlayer alloc] init]; player.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame)); [self addChild:player]; Movement code:
[node.physicsBody applyForce:CGVectorMake(20 * data.acceleration.x, 0)]; Image for reference:
