Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7012873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:18:45+00:00 2026-05-27T22:18:45+00:00

i am trying to scale and rotate a CCSprite using the following methods [rectangleSprite

  • 0

i am trying to scale and rotate a CCSprite using the following methods

[rectangleSprite setRotation:touch1.y];

rectangleSprite.scaleX=(touch1.x-touch2.x)/100;
rectangleSprite.scaleY=(touch1.y-touch2.y)/100;

But when i scale or rotate the sprite its CGRect expands to cover the whole rotated area and collision detection through CGRectIntersectsRect doesn’t work. after a lot of searching i came across following solutions like this but they doesn’t seem to work

how to check for collision with rotated CGRect?

after rotating how can i apply the CGRectApplyAffineTransform to get the new rect according to rotation or is there any other possible way with it?
i am applying the transform in the following way but the rectangle i am getting has negative origin values.. what am i possibly doing wrong?

CGAffineTransform affine;

//  add a rotate
affine = CGAffineTransformMakeRotation(-CC_DEGREES_TO_RADIANS(angle));


CGRect start =[rectangleSprite boundingBox];
NSLog(@"cg rect %f %f",start.size.height ,start.size.width);

CGRect  newRect = CGRectApplyAffineTransform(start, affine);

NSLog(@"cg rect %f %f",rct.origin.x,rct.origin.y);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:18:46+00:00Added an answer on May 27, 2026 at 10:18 pm

    You could always leverage one of the physics libraries packaged with cocos2d to do the collision detection for you instead of rolling your own collision detection. You just have the physics bodies follow your sprite location and rotation in the update function instead of the other way around so the physics engine doesn’t move your sprites for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to scale down a Bitmap using GDI+ by doing the following: Bitmap
I'm trying to rotate and then scale an image using android.graphics.Matrix. The code is
I am trying to scale an image without using the function gluScaleImage which is
I'm trying to scale and rotate in single operation before creting the final bitmap
I am trying to scale an ImageView down in an animation, but whenever I
I am trying to rotate an object around it's center with the following code
I'm trying to scale a view Horizontally but i'm not getting the results i
I'm trying to scale a raphael paper with multiple paths but it doesn't scale
I'm trying to get every widget to scale with change in window size. I
I am trying to parallelise a code using scala actors. That is my first

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.