Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Sprite Anchor Point Bug and PhysicsBody Removing Bug #15812

Closed
eray-z opened this issue Jun 9, 2016 · 5 comments
Closed

The Sprite Anchor Point Bug and PhysicsBody Removing Bug #15812

eray-z opened this issue Jun 9, 2016 · 5 comments

Comments

@eray-z
Copy link

eray-z commented Jun 9, 2016

Hi there.

1- The sprite object anchor point is Vec2(0.5,0.5) as a default.(according to helper documents) Sprite objects doesn't respect anchor point like node objects when I add a new child. The child object must be added center of the sprite object.

I don't have that problem with node objects.Only sprite.

You may try the example helloworldscene.cpp file; http://codepaste.net/9d8rjj
I tried: v3.11.1

2- Another bug, I can't remove PhysicsBody component from any node-node based object. I get "EXC_BAD_ACCESS" error.

You may try the example helloworldscene.cpp file; http://codepaste.net/sfyyy2
I tried: v3.11.1

I had opened this issue in cocos2d-x community.

@ricardoquesada
Copy link
Contributor

Links don't work. Could you post the code to reproduce the bug? thanks.

@ricardoquesada
Copy link
Contributor

The child object must be added center of the sprite object.

this is not correct. the child will always be added to 0,0, regardless of the parent's anchor point.
this is a design feature.

@eray-z
Copy link
Author

eray-z commented Jun 21, 2016

Ok, I tried set parent sprite object anchor point (0.5,0.5) and it's still not working.

@eray-z
Copy link
Author

eray-z commented Jun 21, 2016

And parentSprite->getPosition() always give the center point . But If I add child sprite always add bottom-left point of parentSprite. : (

@ricardoquesada
Copy link
Contributor

that's correct, that's the expected behavior.
children will always be added relative to the bottom/left (0,0) corner of its parent. I added more info in the forum thread: http://discuss.cocos2d-x.org/t/cocos2d-x-node-sprite-anchor-points-and-removing-physicsbody-bugs/29875

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants