We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › Change gravity in BoxWrap2D
Page Index Toggle Pages: 1
Change gravity in BoxWrap2D (Read 688 times)
Change gravity in BoxWrap2D
Mar 2nd, 2010, 5:55am
 
I am trying to figure out a way to change gravity in boxwrap2d using processing. Please help me out
Re: Change gravity in BoxWrap2D
Reply #1 - Mar 2nd, 2010, 7:42am
 
This Topic was moved here from Exhibition by PhiLho.
As asked at the start of my JBox2D with BoxWrap2D Tutorial thread, I prefer to keep dialog out of this thread...
But I appreciate your interest.

My tutorials use only the physics = new Physics(this, width, height); constructor, but there is another constructor, with more parameters: Physics(PApplet parent, float screenW, float screenH,
   float gravX, float gravY,
   float screenAABBWidth, float screenAABBHeight,
   float borderBoxWidth, float borderBoxHeight,
   float pixelsPerMeter)

As you can see, you can set there a vector defining the gravity (gravX, gravY) in terms of direction and strength.
The simpler constructor calls this one with some default parameters:
this(
   parent,  //parent PApplet
   screenW, screenH,
   0.0f,-10.0f,  //gravity vector
   2*screenW,2*screenH,  //AABB (px)
   screenW,screenH,  //hard border (px)
   10.0f);  //scaling factor, pixels per meter
Page Index Toggle Pages: 1