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

  • SEARCH
  • Home
  • 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 7028355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:22:34+00:00 2026-05-28T00:22:34+00:00

I am using the Physics Editor for creating the Polygon in Box2d. It generates

  • 0

I am using the Physics Editor for creating the Polygon in Box2d. It generates the Polygon and works fine in the non-retina display but doesn’t work in the retina display….. I have attached the screen shot for both of the displays.Now when comes to retina display the polygon is not set over the car here’s the image for that

It works completely in non-retina display

It doesn't work with the same polygon as of the sprite - Retina Display

Here’s my code which I am using in the Project

CCSprite *car = [CCSprite spriteWithFile:@"opp_car.png"];
[car setPosition:ccp(wSize.width/2+50,wSize.height/2-120)];
[self addChild:car];
b2BodyDef spriteBodyDef;
spriteBodyDef.type = b2_dynamicBody;    
spriteBodyDef.userData = car;
spriteBodyDef.position.Set(car.position.x/PTM_RATIO, car.position.y/PTM_RATIO);
b2Body *spriteBody = _world->CreateBody(&spriteBodyDef);

b2PolygonShape spriteShape;
[[GB2ShapeCache sharedShapeCache] addShapesWithFile:@"opp_car-hd.plist"];
[[GB2ShapeCache sharedShapeCache] addFixturesToBody:spriteBody forShapeName:@"opp_car-hd"];
[sprite setAnchorPoint:[[GB2ShapeCache sharedShapeCache]anchorPointForShape:@"opp_car-hd"]];

Any Help would be Appreciated

Thanks…….

  • 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-28T00:22:35+00:00Added an answer on May 28, 2026 at 12:22 am

    It’s because cocos2d works in points (1 point is 2 pixels on a retina display), but the way that box2d draws the bodies (debug draw) uses pixels. The creation of the body is perfect (if you were to account for the retina display in that, your world would be twice as big in both dimensions, leading to differences in the physics between retina and non-retina devices), but instead you need to fix your debug draw method. Somewhere there will be a line that ends new GLESDebugDraw(PTM_RATIO); – change that to new GLESDebugDraw(PTM_RATIO * CC_CONTENT_SCALE_FACTOR()); and you should be good.

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

Sidebar

Related Questions

I'm using a Win 7 64-bit system. LibGDX gdx-helloworld-android app works fine. It doesn't
Using AndEngine Physics Box2D i am trying to drag a body from side to
We're using objects that do not necessarily need to leverage the physics engine, but
I'm developing a physics game using AndEngine with box2d physics engine. I have a
Currently I am using the Box2D physics engine in a game of mine -
I am trying to create a concave moving shape using bullet physics SDK but
I have a physics simulation (using Box2D) where bodies with identical integer IDs do
I am making a game using Andengine/Box2D physics addon. I experienced the random crashes
I was trying to get farseer physics engine to work. Everything compiles fine except
I'm using Box2d for a Bike Physics Game, Box2d lets you have fixtures that

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.