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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:52:54+00:00 2026-05-12T11:52:54+00:00

Here is my problem. I have a chipmunk’s rigid body (a soda can standing

  • 0

Here is my problem. I have a chipmunk’s rigid body (a soda can standing up) that i want to change its center of gravity to the bottom of the object so it can fall on its flank when a force is applied to its upper part.

Am I on the right track?

1) For some reason, I am having trouble setting the body’s center of gravity to a specific value. Anyone has an easy solution please?

2) What about the sprite’s center of gravity? Do I need to change it as well? If so, how?

Thank you for clarifying that.

Yohann T.

  • 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-12T11:52:55+00:00Added an answer on May 12, 2026 at 11:52 am

    Nevermind !

    I am answering my own questions since it was 16 hours ago and i got to find it on my own (yea it took me that long to figure it out, what a waste of time). Luckily for you, I am going to share the solution so you won’t have to spend that many hours figuring out.

    1) For some reason, I am having trouble setting the body’s center of gravity to a specific value. Anyone has an easy solution please?

    Answer: You can’t change the center of gravity of a body because in a real simulated world, the center of gravity is NOT MODIFIABLE, unlesss you actually morph the object! ! !

    The way of doing it, is not to create a body with a “box” shape. You have to create the object using vertices so it can be affected by any type of physics, not just movement.

    here is the code I used to create a box around the object:

    int num = 4;
    cpVect verts[] = {
        cpv(-15,-15),
        cpv(-15, 15),
        cpv( 15, 15),
        cpv( 15,-15),
    };
    body = cpBodyNew(1.0f, cpMomentForPoly(1.0f, num, verts, cpvzero));
    body->p = cpv(-280, 240);
    cpSpaceAddBody(space, body);
    shape = cpPolyShapeNew(body, num, verts, cpvzero);
    shape->e = 0.0f; shape->u = 1.5f;
    shape->collision_type = 1;
    cpSpaceAddShape(space, shape);
    

    2) What about the sprite’s center of gravity? Do I need to change it as well? If so, how?

    use this method:

    [sprite setTransformAnchor:ccp(27,54)];
    

    But remember that the coordinates starts at the bottom-left corner of the screen. But you won’t have to touch the sprite if you handle the body’s physics correctly.

    Good luck now !

    Yohann T.

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

Sidebar

Related Questions

Here's the problem: I have couple of pages which gets its content from a
Here's my problem: I have an unmanaged dll that I made.I'm calling one of
Here is my problem: I have a large anchor tag that links to one
Here's my problem: I have a div element that when it's clicked, another div
Here's my problem: I have a selectable grid of div's that are tied to
Here's my problem : I have an Activity that includes a ListView with different
Here's my problem: I have a datagrid that is bound to a collection of
Here's my problem: I have a button in my android application that when I
Here's my problem: I have a virtual method defined in a .h file that
Here's the problem....I have three components...A Page that contains a User Control and a

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.