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

Fix transform issue of PhysicsSprite itself and its children #12239

Merged
merged 2 commits into from Aug 1, 2015

Conversation

pandamicro
Copy link
Contributor

No description provided.

@pandamicro
Copy link
Contributor Author

I'm not sure the solution is a proper one.
I use scheduled update to synchronize the physics world to cocos world.

@minggo @AndyQue @WenhaiLin If you think there is a better solution, please let me know

@pandamicro pandamicro self-assigned this Jun 8, 2015
@pandamicro
Copy link
Contributor Author

@WenhaiLin Please review this PR

@pandamicro
Copy link
Contributor Author

[ci rebuild]


return _transform;
Node::onEnter();
scheduleUpdate();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible that this onEnter method is called more than once.Schedules the update method here may not be a good idea.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The syncPhysicsTransform method should be executed after the other scheduled callbacks is executed. Scheduler does not ensure it.

@pandamicro pandamicro removed this from the v3.8 milestone Aug 1, 2015
@pandamicro pandamicro assigned WenhaiLin and unassigned pandamicro Aug 1, 2015
@pandamicro
Copy link
Contributor Author

@WenhaiLin I have improved the logic with Director::EVENT_AFTER_UPDATE to ensure the transform is synced after scheduler's update.

pandamicro added a commit that referenced this pull request Aug 1, 2015
Fix transform issue of PhysicsSprite itself and its children
@pandamicro pandamicro merged commit 5f9469a into cocos2d:v3 Aug 1, 2015
@pandamicro pandamicro deleted the PhysicsSpriteFix branch August 1, 2015 10:23
@TheCodez
Copy link
Contributor

TheCodez commented Aug 6, 2015

This issue still exists for normal Sprites and Nodes.

@pandamicro
Copy link
Contributor Author

@TheCodez It has nothing todo with normal Sprites and Nodes, the issue is attached with Physics. Can you be more specific ?

@TheCodez
Copy link
Contributor

TheCodez commented Aug 7, 2015

@pandamicro I have one Sprite and a PhysicsBody set to it, this Sprite has a Node attached, which also has a its own PhysicsBody set. Now the problem is, that moving the parent Sprite won't move the child Node's PhysicsBody.

This is also what is described in the forum, because he wasn't talking about PhysicsSprites but normal Sprites:
http://discuss.cocos2d-x.org/t/parent-child-physics-body-position-in-cocos-3-4/20090

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

Successfully merging this pull request may close these issues.

None yet

3 participants