Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to set high velocity in Box2D

    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 383
    Answer it

    I want to throw an object in Box2d by applying a force vector, But it is limited to a certain velocity even if I Apply Force by a very high value? How can I achieve this ? For Ex:- I have to fire a bullet at a very high speed.

    var force = new Box2D.Common.Math.b2Vec2(-700,+500);
                this.body.ApplyForce(force , this.body.GetPosition());
    

    Even if I set the value to (-7000,+5000) there is no effect beyond this. Please help.

 1 Answer(s)

  • I have figured it out that the Box2D.SCALE factor has to be set to get the desired output. As in my project canvas size is 1920 by 1080 and Box2D.SCALE=0.1, that's what creates the drawing area very big that simulate high velocity very slowly. So, to overcome that I have set it to 0.05 Which scaled down my whole game and Now it can make an object seems to travel very fast at the same velocity.

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: