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 3492656
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:47:07+00:00 2026-05-18T11:47:07+00:00

I can´t seem to create a b2PolygonShape with vertices in my Box2D Cocos2D project.

  • 0

I can´t seem to create a b2PolygonShape with vertices in my Box2D Cocos2D project. I get no errors but nothing shows up at the screen.

How do you get a static body with b2PolygonShape vertices to work?

I would like to use it with a list set up like this:

b2Vec2 verts[] = {
        b2Vec2(-194.5f / PTM_RATIO, 83.0f / PTM_RATIO),
        b2Vec2(-118.5f / PTM_RATIO, 65.0f / PTM_RATIO),
        b2Vec2(-77.5f / PTM_RATIO, 2.0f / PTM_RATIO),
        b2Vec2(3.5f / PTM_RATIO, -59.0f / PTM_RATIO),
        b2Vec2(62.5f / PTM_RATIO, -61.0f / PTM_RATIO),
        b2Vec2(108.5f / PTM_RATIO, -63.0f / PTM_RATIO),
        b2Vec2(138.5f / PTM_RATIO, -41.0f / PTM_RATIO),
        b2Vec2(169.5f / PTM_RATIO, 11.0f / PTM_RATIO),
        b2Vec2(184.5f / PTM_RATIO, 49.0f / PTM_RATIO),
        b2Vec2(218.5f / PTM_RATIO, 51.0f / PTM_RATIO),
        b2Vec2(219.5f / PTM_RATIO, -89.0f / PTM_RATIO),
        b2Vec2(-174.5f / PTM_RATIO, -88.0f / PTM_RATIO)
};
  • 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-18T11:47:08+00:00Added an answer on May 18, 2026 at 11:47 am

    The next step will specifying the vertices to shape

         b2PolygonShape shape;
            int num = 4;
            b2Vec2 vertices[] = {
                        b2Vec2(10.5f / PTM_RATIO, 10.6f / PTM_RATIO),
                        b2Vec2(11.8f / PTM_RATIO, 18.1f / PTM_RATIO),
                        b2Vec2(-11.9f / PTM_RATIO, 18.3f / PTM_RATIO),
                        b2Vec2(-10.5f / PTM_RATIO, 10.8f / PTM_RATIO)
                    };
            shape.Set(vertices, num);

    b2FixtureDef fixtureDef;
    fixtureDef.shape = &shape;

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

Sidebar

Related Questions

I'm trying to create a RTMP Streaming application but I can't seem to get
I can't seem to get the Ruby Shoes packager to correctly create an exe
I can't seem to figure out how to get it to create a script
I am trying to create a backbone.js model with dynamic keys but can't seem
I am trying to create a class to handle arrays but I can't seem
I am trying to create a helpful bash alias/function. I can't seem to get
I would like to create a Sphere, actually a globe. But i can't seem
I can't seem to get my Xrm variable working when I create .js code.
I need to create a list like List<String,Object> but I can't seem to do
I am trying to create smaller tabs in android -- but I can't seem

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.