public void setRandomOrientation(Vector3f origin, Vector3f up) { up.copy(v0); v1.x = (float) (0.7 - Math.random() * 1.4); v1.y = (float) (0.7 - Math.random() * 1.4); v1.z = (float) (0.7 - Math.random() * 1.4); MathHelper.getRandomPosition(origin, v1, 16384.0f, 8192.0f); ai.orient(v1, v0, 0); }
public void update(float deltaTime) { ai.update(deltaTime); if (Settings.engineExhaust && exhaust != null) { for (EngineExhaust ex : exhaust) { ex.update(); } } }
public void orientTowards(float x, float y, float z, float ux, float uy, float uz) { v0.x = x; v0.y = y; v0.z = z; v1.x = ux; v1.y = uy; v1.z = uz; ai.orient(v0, v1, 0); }
public void executeHit(SpaceObject player) { ai.executeHit(player); }
public String getCurrentAIStack() { return ai.getStateStack(); }
public AIState getAIState() { return ai.getState(); }
public void setAIState(AIState newState, Object... data) { ai.setState(newState, data); }
public float orientTowardsUsingRollPitch(GraphicObject object, Vector3f up, float deltaTime) { return ai.orientUsingRollPitchOnly(object.getPosition(), up, deltaTime); }
public float orientTowards(GraphicObject object, Vector3f up, float deltaTime) { return ai.orient(object.getPosition(), up, deltaTime); }
public float orientTowards(GraphicObject object, float deltaTime) { object.getUpVector().copy(v0); // v0.negate(); return ai.orient(object.getPosition(), v0, deltaTime); }
public void setProximity(SpaceObject other) { if (other == null) { proximity = null; return; } if (!receivesProximityWarning()) { return; } if (proximity == other) { return; } if (other.getType() == ObjectType.SpaceStation) { if (inBay) { return; } float maxExtentSq = other.getMaxExtent(); maxExtentSq *= maxExtentSq; if (other.getPosition().distanceSq(getPosition()) > maxExtentSq) { return; } } if (other.getType() == ObjectType.Missile) { if (((Missile) other).getSource() == this) { return; } } other.getPosition().sub(getPosition(), v0); float dotForward = v0.dot(getForwardVector()); float dotUp = v0.dot(getUpVector()); float dotRight = v0.dot(getRightVector()); if (dotForward < 0 && getSpeed() < 0) { dotForward *= 0.25f * getMaxSpeed() / -getSpeed(); } float dotSq = dotForward * dotForward + dotUp * dotUp + dotRight * dotRight; float collisionSq = getBoundingSphereRadius() * 3.0f + other.getBoundingSphereRadius() * 3.0f; collisionSq *= collisionSq; if (dotSq > collisionSq) { return; } if (ai.getState() == AIState.EVADE) { if (proximity != null && proximity != other) { getPosition().sub(proximity.getPosition(), v0); v0.normalize(); float angleProx = getForwardVector().angleInDegrees(v0); if (angleProx >= 180) { angleProx = 360 - angleProx; } getPosition().sub(other.getPosition(), v0); v0.normalize(); float angleOther = getForwardVector().angleInDegrees(v0); if (angleOther >= 180) { angleOther = 360 - angleOther; } if (angleProx < angleOther) { return; } } } proximity = other; }