Package sk.fiit.jim.agent.models

Examples of sk.fiit.jim.agent.models.DynamicObject


    return prophecy;
  }

  @Problem("do not ignore friction")
  private void calculateBallPosition(){
    DynamicObject ball = world.getBall();
    if (ball.getSpeed() == null){
      prophecy.setBallRelativePosition(agent.relativize(Vector3D.ZERO_VECTOR));
      prophecy.setBallPosition(Vector3D.ZERO_VECTOR);
      prophecy.setBallPositionRelativized(agent.relativize(Vector3D.ZERO_VECTOR));
      return;
    }
   
    Vector3D whereItIsNow = ball.getSpeed().multiply(now - ball.getLastTimeSeen()).add(ball.getPosition());
    Vector3D whereWillItBe = ball.getSpeed().multiply(offset).add(whereItIsNow);
    Vector3D whereWillItBeBasedOnRelativeSpeed = ball.getRelativeSpeed().multiply(now - ball.getLastTimeSeen() + offset).add(ball.getRelativePosition());
   
    prophecy.setBallPosition(whereWillItBe);
    prophecy.setBallPositionRelativized(agent.relativize(whereWillItBe));
    prophecy.setBallRelativePosition(whereWillItBeBasedOnRelativeSpeed);
  }
View Full Code Here


    return prophecy;
  }

  @Problem("do not ignore friction")
  private void calculateBallPosition(){
    DynamicObject ball = world.getBall();
    if (ball.getSpeed() == null){
      prophecy.setBallRelativePosition(agent.relativize(Vector3D.ZERO_VECTOR));
      prophecy.setBallPosition(Vector3D.ZERO_VECTOR);
      prophecy.setBallPositionRelativized(agent.relativize(Vector3D.ZERO_VECTOR));
      return;
    }
   
    Vector3D whereItIsNow = ball.getSpeed().multiply(now - ball.getLastTimeSeen()).add(ball.getPosition());
    Vector3D whereWillItBe = applyFriction(ball.getSpeed(), offset).add(whereItIsNow);
    Vector3D whereWillItBeBasedOnRelativeSpeed = applyFriction(ball.getRelativeSpeed(), now - ball.getLastTimeSeen() + offset).add(ball.getRelativePosition());
   
    prophecy.setBallPosition(whereWillItBe);
    prophecy.setBallPositionRelativized(agent.relativize(whereWillItBe));
    prophecy.setBallRelativePosition(whereWillItBeBasedOnRelativeSpeed);
  }
View Full Code Here

TOP

Related Classes of sk.fiit.jim.agent.models.DynamicObject

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.