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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:04:35+00:00 2026-06-10T22:04:35+00:00

I have issue regarding speed in air. When I jump and move simultaneously that

  • 0

I have issue regarding speed in air.

When I jump and move simultaneously that time speed of player increase. I use impuls for jump and I use force for movement .I want to know how to slow down it when player is in air.

This is my code of movement left and right

-(void)update:(ccTime)dt :(b2Body *)ballBody :(CCSprite *)player1 :(b2World *)world
{

    if (moveRight.active==YES) 
    {   
  //      maxSpeed=10.0f;
            ballBody->SetActive(true);
    //    b2Vec2 locationworld=b2Vec2(maxSpeed,0);
        double mass=ballBody->GetMass();
        ballBody->ApplyForce(mass*locationworld, ballBody->GetWorldCenter());
        ballBody->SetLinearDamping(1.2f);
    }
    else if(moveLeft.active==YES)
    {
            ballBody->SetActive(true);
        b2Vec2 locationworld=b2Vec2(-10,0);
        double mass=ballBody->GetMass();
        ballBody->ApplyForce(mass*locationworld, ballBody->GetWorldCenter());
    //    ballBody->SetLinearDamping(1.2f);

    }
}

And following is for jumping player

-(void)jump:(b2Body*)ballBody:(ccTime)dt:(BOOL)touch
{
    if (touch) 
    {

        if (jumpSprte.active==YES) 
        {
            ballBody->SetActive(true);
            b2Vec2 locationWorld;
            locationWorld=b2Vec2(0,25);
            ballBody->ApplyLinearImpulse(locationWorld, ballBody->GetWorldCenter());

        }
    }
}

So where i used logic??

Thanks in advance

  • 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-06-10T22:04:37+00:00Added an answer on June 10, 2026 at 10:04 pm

    You need to model air resistance to slow the player down in the air. There are several ways to do this depending on how realistic you want the simulation to be. For a simple model linearDampening would slow it down.

    True air resistance is not linear. To model this in a more realistic way you’d need to use something like this:

    F = - C * v * |v| 
    
    • F is the total force of the air drag
    • C is a drag constant that depends on the shape of the object
    • v is the velocity vector ( |v| is the magnitude of the velocity, or length if you so wish)

    It also sounds like your players are able to increase their speed while in the air using move. This is because you allow the player to apply force while his legs aren’t touching the ground. In order to disallow this if this is your goal make sure that when the character is touching the ground is the only time when more force can be applied to make him move.

    Note that this all very much depends on what sort of game you want this to be. If it looks and feels good when making physics for games it is good. Do not stress out if you don’t manage to make a wholly accurate simulation of reality as long as the end result plays well.

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

Sidebar

Related Questions

I have an issue regarding Sendkeys Class, as i want to use this class
i have an issue regarding UitableViewCell. the issue is that i have made a
I have a synchronization issue regarding a bind request and a upstream handler that
I have a little issue regarding IN operator in javascript. As we know that
I have an issue regarding an recursive count which works well in SQL server,
I have an issue regarding to auto populating a select dropdown from jQuery/JSON data
I have recently run into a particularly sticky issue regarding committing the result of
I have seen a few posts regarding this issue but not one specific to
I have a follow-up question regarding an issue I previously had on SO here
I have gone through many posts on SO regarding this issue: Tried everything in

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.