Package org.jbox2d.dynamics

Examples of org.jbox2d.dynamics.BodyDef


   */
  protected PhysicalArea(int contentPower,boolean beControlled, Point p, double w, double h, double angle) {
    super(contentPower,beControlled, p, w, h, angle);
   
    if(isVerified()){
      BodyDef bodyDef=new BodyDef();
      bodyDef.position.set(CoordinateConverter.coordPixelToWorld(position));
      this.body=creator.getWorld().getWorld().createBody(bodyDef);
    }
   
  }
View Full Code Here


    brP.translate(7.5f, 0);
    points=Point.getRotatedPoint(getPosition(), getAngle(),tlP,trP,crossP,bmP,blP,brP);
   
    Vec2 crossV=CoordinateConverter.vectorPixelToWorld(position.delta(crossP));
   
    BodyDef bodyD=new BodyDef();
    PolygonShape[] edges=new PolygonShape[]{new PolygonShape(),new PolygonShape(),new PolygonShape(),new PolygonShape()};
   
    bodyD.type=BodyType.STATIC;
    bodyD.angle=(float)-getAngle();
    bodyD.position.set(CoordinateConverter.coordPixelToWorld(getPosition()));
View Full Code Here

  protected PhysicalLine(int contentPower,boolean beControlled, Point p1,Point p2, CssColor color) {
    super(contentPower, beControlled, p1, p2);
    if(this.isVerified()){
      this.lineColor=color;
     
      BodyDef bodyDef=new BodyDef();
      bodyDef.position.set(CoordinateConverter.coordPixelToWorld(position));
      this.body=creator.getWorld().getWorld().createBody(bodyDef);
    }
  }
View Full Code Here

    Point swP=neP.clone();
    seP.translate(getHeight(), getHeight());
    swP.translate(-getHeight(), getHeight());
    this.points=Point.getRotatedPoint(getPosition(),getAngle(),nwP,neP,seP,swP);
   
    BodyDef bodyD=new BodyDef();
    PolygonShape[] edges=new PolygonShape[]{new PolygonShape(),new PolygonShape(),new PolygonShape(),new PolygonShape()};
   
    bodyD.type=BodyType.STATIC;
    bodyD.angle=(float)-getAngle();
    bodyD.position.set(CoordinateConverter.coordPixelToWorld(getPosition()));
View Full Code Here

    super(contentPower,p, w, h, angle);
    if(this.isVerified()){
      this.borderColor=color;
      this.controller=controller;
     
      BodyDef bodyDef=new BodyDef();
      bodyDef.type=BodyType.DYNAMIC;
      bodyDef.userData=this;
      bodyDef.position.set(CoordinateConverter.coordPixelToWorld(position));
      bodyDef.angle=(float)-angle;
     
View Full Code Here

    this.space=space;
   
   
    aabb=new PixelAABB(this.position,width,height);
   
    BodyDef bodyDef=new BodyDef();
    CircleShape shape=new CircleShape();
    FixtureDef fixtureDef=new FixtureDef();
    Vec2 impulse=CoordinateConverter.vectorPixelsToWorld(new Vector(-30+60*Random.nextDouble(),-(175+50*Random.nextDouble())));
   
    bodyDef.type=BodyType.DYNAMIC;
 
View Full Code Here

    super(p,500,150);
   
    this.space=space;
    this.image=MEngine.getAssetManager().getSpriteSheet("volcano.png");
   
    BodyDef bodyDef=new BodyDef();
    bodyDef.position.set(CoordinateConverter.coordPixelsToWorld(p));
    PolygonShape shape=new PolygonShape();
    Vec2[] vertices={
        CoordinateConverter.vectorPixelsToWorld(new Vector(-250,75)),
        CoordinateConverter.vectorPixelsToWorld(new Vector(250,75)),
View Full Code Here

  public Collection<Shape> getGround() {
    return Collections.unmodifiableCollection(ground);
  }
 
  public void addObject(WorldObject wo, boolean fastObject) {
    BodyDef def = wo.getBodyDef();
    Body body = jbox2dWorld.createDynamicBody(def);
    body.setBullet(fastObject);
    Vector2d vel = wo.getVelocity();
    body.setLinearVelocity(new Vec2((float) vel.getX(), (float) vel.getY()));
    for (ShapeDef sd : wo.getShapeDefs()) {
View Full Code Here

    body.applyImpulse(impulse, body.getWorldCenter());
  }
 
  @Override
  public BodyDef getBodyDef() {
    BodyDef def = new BodyDef();
    def.angle = (float) rotation;
    def.position = new Vec2((float) position.getX(), (float) position.getY());
    def.massData.mass = (float) mass;
    def.massData.I = (float) momentOfInertia;
    def.userData = this;
View Full Code Here

   * @param shape The shape the body should have
   * @param x The x axis location of the body
   * @param y The y axis location of the body
   */
  public Body(Shape shape, float x, float y) {
    jboxBodyDef = new BodyDef();
    jboxBodyDef.position = new Vec2(x,y);
    this.shape = shape;
  }
View Full Code Here

TOP

Related Classes of org.jbox2d.dynamics.BodyDef

Copyright © 2018 www.massapicom. 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.