Examples of Physical


Examples of com.google.gwt.maeglin89273.game.mengine.component.Physical

   * @see com.google.gwt.maeglin89273.game.mengine.component.GeneralComponent#update()
   */
  @Override
  public void update() {
   
    Physical dc;
    for(int i=contentCreations.size()-1;i>=0;i--){
      dc=contentCreations.get(i);
      if(dc.isDestroyed()){
        contentCreations.remove(i);
      }else{
        dc.getBody().applyForce(forceVec, dc.getBody().getWorldCenter());
      }
    }
  }
View Full Code Here

Examples of com.google.gwt.maeglin89273.game.mengine.component.Physical

  @Override
  public void update(){
    Vec2 shapePos;
    Vec2 pAToShape;
    Vec2 pBToShape;
    Physical dc;
    for(int i=creationsInField.size()-1;i>=0;i--){
      dc=creationsInField.get(i);
      if(dc.isDestroyed()){
        creationsInField.remove(i);
      }else{
        shapePos=dc.getBody().getWorldCenter();
        pAToShape=shapePos.sub(vecA);
        pBToShape=shapePos.sub(vecB);
        if(Vec2.dot(pAToShape, vecAToB)<0){
          if(pAToShape.lengthSquared()>ASBOTXConfigs.E_SQUARE){
            pAToShape.negateLocal();
            pAToShape.normalize();
            pAToShape.mulLocal(FORCE_MAGNITUDE);
            dc.getBody().applyForce(pAToShape,shapePos);
          }
        }else if(Vec2.dot(pBToShape, vecBToA)<0){
          if(pBToShape.lengthSquared()>ASBOTXConfigs.E_SQUARE){
            pBToShape.negateLocal();
            pBToShape.normalize();
            pBToShape.mulLocal(FORCE_MAGNITUDE);
            dc.getBody().applyForce(pBToShape,shapePos);
          }
        }else{
          dc.getBody().applyForce(Vec2.cross(pAToShape,vecAToB)>0?forces[0]:forces[1],shapePos);
        }
      }
    }
  }
View Full Code Here

Examples of com.google.gwt.maeglin89273.game.mengine.component.Physical

   * @see com.google.gwt.maeglin89273.game.mengine.component.GeneralComponent#update()
   */
  @Override
  public void update() {
    Vec2 v;
    Physical dc;
    for(int i=contentCreations.size()-1;i>=0;i--){
      dc=contentCreations.get(i);
      if(dc.isDestroyed()){
        contentCreations.remove(i);
      }else{
       
        v=center.sub(dc.getBody().getPosition());
        float lengthS=v.lengthSquared();
       
        if(lengthS>ASBOTXConfigs.E_SQUARE){
          v.normalize();
          v.mulLocal((float)radius*K*dc.getBody().getMass());
          dc.getBody().applyForce(v, dc.getBody().getWorldCenter());
        }
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.