package edu.ups.gamedev.weapons;
import com.jme.math.Ray;
import com.jme.math.Vector3f;
import com.jme.scene.Node;
import edu.ups.gamedev.game.Tools;
import edu.ups.gamedev.scene.Collidable;
/**
* RayWeapons, upon being fired, instantly do a ray pick along their given
* vector and detonate their warheads at the pick point.
*
* @author stefan
*/
public class RayFireable extends BasicFireable {
static final long serialVersionUID = 1;
@Override
public boolean canCollideWith(Collidable object) {
return true;
}
@Override
public void fire(Ray vector, Vector3f force, Node rootNode) {
// instantly ray picks and collides
Vector3f store = new Vector3f();
Tools.pointPick(vector, rootNode, store);
Ray ray = new Ray(store, vector.direction);
warhead.detonate(ray, rootNode);
cleanup();
}
}