Skip to content

Problems with Physics when use animation #1595

Closed Answered by rh101
halx99 asked this question in Q&A
Discussion options

You must be logged in to vote

This is wrong?

Sorry, I'll clarify. This code is correct:
bomb->setContentSize(Vec2(78, 64) / AX_CONTENT_SCALE_FACTOR());

What is not correct is this remark regarding the content size and your usage of it:

The line that change something on it and make it work is related to scale as you write above, not content size position in my code, since it is before physics body definition:

The reason is that the line bomb->setContentSize(Vec2(78, 64) was setting a content size of 78,64, but when it is animating, setSpriteFrame was calling setContentSize with 97.5, 80.0, because of the scale factor. As a result of this, whatever parameters are changed within the node end up affecting the physics …

Replies: 12 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by halx99
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
4 participants
Converted from issue

This discussion was converted from issue #1573 on January 10, 2024 14:47.