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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:26:07+00:00 2026-05-26T07:26:07+00:00

I have 2 questions with b2Body: What is the difference between b2Body and b2BodyDef?

  • 0

I have 2 questions with b2Body:

  1. What is the difference between b2Body and b2BodyDef?
  2. How would I add a b2Body to a CCScene with coordinates from a CGRect which I already have coded? Also how would I add userData to it so I can keep a reference to this?

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-26T07:26:08+00:00Added an answer on May 26, 2026 at 7:26 am

    A b2BodyDef is used to define information about a body as a whole, such as position and rotation. Compared to the other information you require for a b2Body, such as friction and resititution, that is defined on a per fixture basis using b2Fixtures. The b2Body is an amalgamation of a body definition and at least one fixture.

    With regard to creating the body from a predefined rect, I’d advise using setAsBox: assuming you are using a b2PolygonShape.

    The way I usually accomplish the joining of the two is to create a class called BodyNode which has ivars of a b2Body and a CCSprite. Assign either the BodyNode, i.e. self or the sprite as the userData and update them as follows:

    -(void) onEnter
    {
        [self scheduleUpdate];
        [super onEnter];
    }
    
    -(void) update:(ccTime) dt
    {
        //Update the position of the sprite to the position of the body
        //Update the rotation of the body to the rotation of the sprite. Take care to note that the rotation of the sprite is in degrees whereas the rotation of the body is in radians.
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to have questions marked as Edited, but I dont know what
I would like to implement a URL rewrriter for DotNetNuke. Have questions as to
I have questions about 'Response' from server. 'content in HTTP Response' is same meaning
I have questions which are represented like this in my SQL database : CREATE
I have questions which I'm reading form database and with while loop I show
I have questions about inheriting(extending) methods from classes and hiding some classes and methods
I have questions about System.Threading.ThreadStart Class : where can I find its specifications (
I am going to be making a small user system but I have questions.
I want to create some simple navigation in sencha touch 2. I have questions
have 2 questions : A computer with 32-bit address uses 2-level page table (9

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.