DNESS / cocos2d-iphone

Automatically exported from code.google.com/p/cocos2d-iphone
1 stars 0 forks source link

A Particles in FreeSpace don't work on rotated sprite #1105

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
A Particle in FreeSpace mode attached to a sprite that has a rotation causes 
the particle to use local space and not world space

What steps will reproduce the problem?
1. Create a Sprite
2. Rotate the sprite  //Remove this step and it works correctly
3. Create a particle and attach it as a child of the sprite
4. Set particle to FreeSpace mode
5. Perform CCMoveBy action on the sprite

CCSprite *sprite = [CCSprite spriteWithFile:@"background.png"];
[myTestLayer addChild:sprite];

CCParticleSystemQuad* particle = [CCParticleSystemQuad 
particleWithFile:@"smoke.plist"];
[sprite addChild:particle];
particle.positionType_ = kCCPositionTypeFree;
particle.autoRemoveOnFinish_ = YES;

// Comment this line out and the issue does not occor
//[sprite setRotation:90];

[sprite runAction: [CCMoveBy actionWithDuration:5 position:ccp(280,440)]];

What is the expected output? What do you see instead?
Particle should use world space
Particles is using rotated local space instead of world space for movement

What cocos2d version are you using ?
cocos2d-iphone-0.99.5

What iOS / Mac SDK are you using ?
iOS 4.2

Debug or Release ?
Both

Which target device / target OS are you using ?
iPhone 4.2

iOS only: Does this happens on device ? or on the simulator ? or on both ?
simulator.  Dont have a device to test right now

Mac only: x86 or i386 ?
i386

Please provide any additional information below.

I'm guessing that the particle is being built correctly in world space. But 
when the nodes are being traversed for drawing the parents rotation is being 
applied just before it is drawn.  Possibly for particles with parents their 
rotation should consider the inverse parents rotation during creation to 
correct for this.  I have not stepped through the draw code only the particle 
creation so this is just a theory.

I have attached my smoke.plist particle file it is a simple effect that emits 
particles in 360 degrees but looks like a smoke trail when moving.

Original issue reported on code.google.com by sabbamo...@gmail.com on 5 Feb 2011 at 12:10

GoogleCodeExporter commented 9 years ago
I don't see the attached file. Could you re-attach it ? Thanks.

Original comment by ricardoq...@gmail.com on 8 Feb 2011 at 12:57

GoogleCodeExporter commented 9 years ago
File attached

Original comment by sabbamo...@gmail.com on 8 Feb 2011 at 4:02

Attachments: