本文整理匯總了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);
}
}