<commit_before>/*******************************************************************************
 * This file is part of TERMINAL RECALL
 * Copyright (c) 2012-2014 <NAME>
 * Part of the jTRFP.org project
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Contributors:
 *     chuck - initial API and implementation
 ******************************************************************************/

package org.jtrfp.trcl.beh;

import org.jtrfp.trcl.core.TR;
import org.jtrfp.trcl.math.Vect3D;
import org.jtrfp.trcl.obj.WorldObject;

public class RotateAroundObject extends Behavior {
    private WorldObject target;
    private double distance=TR.mapSquareSize;
    private double angularVelocityRPS = .25;
    final double [] delta = new double[3];
    private double []offset = new double[]{0,0,0};
    @Override
    public void _tick(long tickTimeMillis){
	if(target!=null){
	    final WorldObject parent	= getParent();
	    final double [] tPos	= target.getPosition();
	    final double [] pPos	= parent.getPosition();
	    //Theta = [0,2]pi
	    final double theta = (((angularVelocityRPS*tickTimeMillis) / 1000.)%1.)*2*Math.PI;
	    delta[0]=Math.sin(theta);	//X
	    delta[2]=Math.cos(theta);	//Z
	    delta[1]=0;			//Y
	    Vect3D.scalarMultiply(delta, distance, delta);
	    Vect3D.add(delta, offset, delta);
	    Vect3D.add(tPos, delta, pPos);
	    parent.setPosition(pPos[0],pPos[1],pPos[2]);
	    parent.notifyPositionChange();//TODO: Remove and see if it still works
	}//end if(!null)
    }//end _tick(...)
    /**
     * @return the target
     */<commit_msg>Remoevd superflouous position setting in RotateAroundObject.<commit_after>/*******************************************************************************
 * This file is part of TERMINAL RECALL
 * Copyright (c) 2012-2014 <NAME>
 * Part of the jTRFP.org project
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Contributors:
 *     chuck - initial API and implementation
 ******************************************************************************/

package org.jtrfp.trcl.beh;

import org.jtrfp.trcl.core.TR;
import org.jtrfp.trcl.math.Vect3D;
import org.jtrfp.trcl.obj.WorldObject;

public class RotateAroundObject extends Behavior {
    private WorldObject target;
    private double distance=TR.mapSquareSize;
    private double angularVelocityRPS = .25;
    final double [] delta = new double[3];
    private double []offset = new double[]{0,0,0};
    @Override
    public void _tick(long tickTimeMillis){
	if(target!=null){
	    final WorldObject parent	= getParent();
	    final double []tPos	= target.getPosition();
	    final double []pPos	= parent.getPosition();
	    //Theta = [0,2]pi
	    final double theta = (((angularVelocityRPS*tickTimeMillis) / 1000.)%1.)*2*Math.PI;
	    delta[0]=Math.sin(theta);	//X
	    delta[2]=Math.cos(theta);	//Z
	    delta[1]=0;			//Y
	    Vect3D.scalarMultiply(delta, distance, delta);
	    Vect3D.add(delta, offset, delta);
	    Vect3D.add(tPos, delta, pPos);
	    //parent.setPosition(pPos[0],pPos[1],pPos[2]);
	    parent.notifyPositionChange();
	}//end if(!null)
    }//end _tick(...)
    /**
     * @return the target
     */
{'fraction_non_alphanumeric': 0.2065063649222065, 'fraction_numerical': 0.019801980198019802, 'mean_word_length': 3.8438356164383563, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1214353', 'n_tokens_mistral': 1138, 'n_tokens_neox': 1058, 'n_words': 282}