本文整理汇总了Java中org.lwjgl.util.vector.Vector2f.add方法的典型用法代码示例。如果您正苦于以下问题:Java Vector2f.add方法的具体用法?Java Vector2f.add怎么用?Java Vector2f.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.util.vector.Vector2f
的用法示例。
在下文中一共展示了Vector2f.add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: estimateIncomingDamage
import org.lwjgl.util.vector.Vector2f; //导入方法依赖的package包/类
public static float estimateIncomingDamage(ShipAPI ship, float damageWindowSeconds) {
float accumulator = 0f;
accumulator += estimateIncomingBeamDamage(ship, damageWindowSeconds);
for (DamagingProjectileAPI proj : Global.getCombatEngine().getProjectiles()) {
if(proj.getOwner() == ship.getOwner()) continue; // Ignore friendly projectiles
Vector2f endPoint = new Vector2f(proj.getVelocity());
endPoint.scale(damageWindowSeconds);
Vector2f.add(endPoint, proj.getLocation(), endPoint);
if((ship.getShield() != null && ship.getShield().isWithinArc(proj.getLocation()))
|| !CollisionUtils.getCollides(proj.getLocation(), endPoint,
new Vector2f(ship.getLocation()), ship.getCollisionRadius()))
continue;
accumulator += proj.getDamageAmount() + proj.getEmpAmount();// * Math.max(0, Math.min(1, Math.pow(1 - MathUtils.getDistance(proj, ship) / safeDistance, 2)));
}
return accumulator;
}
示例2: damageReader
import org.lwjgl.util.vector.Vector2f; //导入方法依赖的package包/类
private static float damageReader(ShipAPI ship, float damageWindowSeconds) {
float accumulator = 0f;
float shipFace = ship.getFacing();
accumulator += beamReader(ship, damageWindowSeconds);
for (DamagingProjectileAPI proj : Global.getCombatEngine().getProjectiles()) {
if(proj.getOwner() == ship.getOwner()) continue; // Ignore friendly projectiles
Vector2f endPoint = new Vector2f(proj.getVelocity());
endPoint.scale(damageWindowSeconds);
Vector2f.add(endPoint, proj.getLocation(), endPoint);
if((ship.getShield() != null && ship.getShield().isWithinArc(proj.getLocation()))
|| !CollisionUtils.getCollides(proj.getLocation(), endPoint,
new Vector2f(ship.getLocation()), ship.getCollisionRadius()))
continue;
if (shipFace - 45f <= Math.abs(MathUtils.getShortestRotation(proj.getFacing(), VectorUtils.getAngle(proj.getLocation(), ship.getLocation()))) ||
shipFace + 45f >= Math.abs(MathUtils.getShortestRotation(proj.getFacing(), VectorUtils.getAngle(proj.getLocation(), ship.getLocation())))) {
accumulator += proj.getDamageAmount() + proj.getEmpAmount();
}
}
return accumulator;
}
示例3: calcFlarePositions
import org.lwjgl.util.vector.Vector2f; //导入方法依赖的package包/类
private void calcFlarePositions(Vector2f sunToCenter, Vector2f sunCoords){
for(int i=0;i<flareTextures.length;i++){
Vector2f direction = new Vector2f(sunToCenter);
direction.scale(i * spacing);
Vector2f flarePos = Vector2f.add(sunCoords, direction, null);
flareTextures[i].setScreenPos(flarePos);
}
}