Package net.cis.client.game.common.model.ai.impl.simple

Source Code of net.cis.client.game.common.model.ai.impl.simple.SimpleRotator

package net.cis.client.game.common.model.ai.impl.simple;

import net.cis.client.game.common.model.ai.AIContext;
import net.cis.client.game.common.model.ai.AINode;
import net.cis.client.game.common.model.ai.AIResult;
import net.cis.client.game.common.model.co.AbstractControlledObject;

import com.jme3.math.Quaternion;

public class SimpleRotator extends AINode
  {

  @Override
  public AIResult Execute(AbstractControlledObject<?, ?> obj, AIContext ctx, float gameTime)
    {
    Quaternion rotation = obj.dataObject.getRotation();
    if(rotation == null)
      rotation = new Quaternion();
   
    //TODO: use angular velocity
    float rot = 0.01f * gameTime;
    obj.dataObject.setRotation(rotation.mult(new Quaternion(rot, rot, rot, 1)));

    return AIResult.Success;
    }

  }
TOP

Related Classes of net.cis.client.game.common.model.ai.impl.simple.SimpleRotator

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.