Difference between get_rect() and get_AABB() for Sprite

23 views
Skip to first unread message

che...@sina.com

unread,
Jul 17, 2018, 8:12:53 AM7/17/18
to cocos2d discuss
I have checked the online document for Sprite introduction, but still confused about the two functions difference.

So, could someone explain to me the detailed differences for them?

Thank you so much.

claudio canepa

unread,
Jul 17, 2018, 11:12:05 AM7/17/18
to cocos2d discuss
get_rect does not handle sprite rotations, get_AABB accounts for rotations.
Examples:
    test\test_rect.py
    test\test_sprite_aabb.py

   




--
You received this message because you are subscribed to the Google Groups "cocos2d discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cocos-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to cocos-...@googlegroups.com.
Visit this group at https://groups.google.com/group/cocos-discuss.
For more options, visit https://groups.google.com/d/optout.

carmen

unread,
Jul 18, 2018, 5:50:56 AM7/18/18
to cocos-...@googlegroups.com

Thanks Canepa.

 

But seems get_rect() doesn’t work well when image_anchor is not (0, 0), that’s why?

 

 

From: claudio canepa
Sent: 2018
717 23:12
To: cocos2d discuss
Subject: Re: Difference between get_rect() and get_AABB() for Sprite

 

get_rect does not handle sprite rotations, get_AABB accounts for rotations.

Examples:

    test\test_rect.py

    test\test_sprite_aabb.py

 

   

 

 

 

On Tue, Jul 17, 2018 at 9:12 AM, <che...@sina.com> wrote:

I have checked the online document for Sprite introduction, but still confused about the two functions difference.

 

So, could someone explain to me the detailed differences for them?

 

Thank you so much.

 

--

You received this message because you are subscribed to the Google Groups "cocos2d discuss" group.

To unsubscribe from this group and stop receiving emails from it, send an email to cocos-discus...@googlegroups.com.


To post to this group, send email to cocos-...@googlegroups.com.
Visit this group at https://groups.google.com/group/cocos-discuss.
For more options, visit https://groups.google.com/d/optout.

 

--

You received this message because you are subscribed to the Google Groups "cocos2d discuss" group.

To unsubscribe from this group and stop receiving emails from it, send an email to cocos-discus...@googlegroups.com.

claudio canepa

unread,
Jul 18, 2018, 9:59:34 AM7/18/18
to cocos2d discuss
I don't know for sure, guess one of the following

   - make get_rect more lightweight by sticking to a simpler case
  -  anchor considerations were overlooked when get_rect was coded

I would use get_AABB


On Wed, Jul 18, 2018 at 6:50 AM, carmen <che...@sina.com> wrote:

Thanks Canepa.

 

But seems get_rect() doesn’t work well when image_anchor is not (0, 0), that’s why?

 

 

From: claudio canepa
Sent: 2018
717 23:12
To: cocos2d discuss
Subject: Re: Difference between get_rect() and get_AABB() for Sprite

 

get_rect does not handle sprite rotations, get_AABB accounts for rotations.

Examples:

    test\test_rect.py

    test\test_sprite_aabb.py

 

   

 

 

 

On Tue, Jul 17, 2018 at 9:12 AM, <che...@sina.com> wrote:

I have checked the online document for Sprite introduction, but still confused about the two functions difference.

 

So, could someone explain to me the detailed differences for them?

 

Thank you so much.

 

--

You received this message because you are subscribed to the Google Groups "cocos2d discuss" group.

To unsubscribe from this group and stop receiving emails from it, send an email to cocos-discuss+unsubscribe@googlegroups.com.


To post to this group, send email to cocos-...@googlegroups.com.
Visit this group at https://groups.google.com/group/cocos-discuss.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "cocos2d discuss" group.

To unsubscribe from this group and stop receiving emails from it, send an email to cocos-discuss+unsubscribe@googlegroups.com.


To post to this group, send email to cocos-...@googlegroups.com.
Visit this group at https://groups.google.com/group/cocos-discuss.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "cocos2d discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cocos-discuss+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages