Package edu.ups.gamedev.weapons

Source Code of edu.ups.gamedev.weapons.RayFireable

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();
  }

}
TOP

Related Classes of edu.ups.gamedev.weapons.RayFireable

TOP
Copyright © 2018 www.massapi.com. 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.