• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Steerable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.badlogic.gdx.ai.steer.Steerable的典型用法代码示例。如果您正苦于以下问题:Java Steerable类的具体用法?Java Steerable怎么用?Java Steerable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Steerable类属于com.badlogic.gdx.ai.steer包,在下文中一共展示了Steerable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: applyConfigs

import com.badlogic.gdx.ai.steer.Steerable; //导入依赖的package包/类
@Override
public void applyConfigs(SteeringBehaviorComponent steeringBC) {
    Wander wander = (Wander)steeringBC.behavior;
    Steerable steerable = wander.getOwner();
    steerable.setMaxLinearSpeed(MAX_LINEAR_SPEED);
    steerable.setMaxLinearAcceleration(MAX_LINEAR_ACCELERATION);
    steerable.setMaxAngularSpeed(MAX_ANGULAR_SPEED);
    steerable.setMaxAngularAcceleration(MAX_ANGULAR_ACCELERATION);

    wander.setWanderRadius(0.1f);
    wander.setTimeToTarget(0.1f);
    wander.setDecelerationRadius(1f);
    wander.setFaceEnabled(false);
    wander.setWanderOrientation(250f);

}
 
开发者ID:unlimitedggames,项目名称:gdxjam-ugg,代码行数:17,代码来源:WatcherConfig.java


示例2: applyConfigs

import com.badlogic.gdx.ai.steer.Steerable; //导入依赖的package包/类
@Override
public void applyConfigs(SteeringBehaviorComponent steeringBC) {
    Wander wander = (Wander)steeringBC.behavior;
    Steerable steerable = wander.getOwner();
    steerable.setMaxLinearSpeed(MAX_LINEAR_SPEED);
    steerable.setMaxLinearAcceleration(MAX_LINEAR_ACCELERATION);
    steerable.setMaxAngularSpeed(MAX_ANGULAR_SPEED);
    steerable.setMaxAngularAcceleration(MAX_ANGULAR_ACCELERATION);

    wander.setWanderRadius(0.1f);
    wander.setTimeToTarget(0.1f);
    wander.setDecelerationRadius(0f);
    wander.setFaceEnabled(false);
    wander.setWanderOrientation(250f);

}
 
开发者ID:unlimitedggames,项目名称:gdxjam-ugg,代码行数:17,代码来源:WatcherSlowerConfig.java


示例3: applyConfigs

import com.badlogic.gdx.ai.steer.Steerable; //导入依赖的package包/类
@Override
public void applyConfigs(SteeringBehaviorComponent steeringBC) {
    Wander wander = (Wander)steeringBC.behavior;
    Steerable steerable = wander.getOwner();
    steerable.setMaxLinearSpeed(MAX_LINEAR_SPEED);
    steerable.setMaxLinearAcceleration(MAX_LINEAR_ACCELERATION);
    steerable.setMaxAngularSpeed(MAX_ANGULAR_SPEED);
    steerable.setMaxAngularAcceleration(MAX_ANGULAR_ACCELERATION);
    //wander.setTarget(loc);
    wander.setWanderRadius(5f);
    wander.setTimeToTarget(0.1f);
    wander.setDecelerationRadius(3f);
    wander.setFaceEnabled(false);
    wander.setWanderOrientation(250f);

}
 
开发者ID:unlimitedggames,项目名称:gdxjam-ugg,代码行数:17,代码来源:WanderConfig.java


示例4: reportNeighbor

import com.badlogic.gdx.ai.steer.Steerable; //导入依赖的package包/类
@Override
public boolean reportNeighbor (Steerable<T> neighbor) {

	toAgent.set(owner.getPosition()).sub(neighbor.getPosition());
	float distanceSqr = toAgent.len2();
	float maxAcceleration = getActualLimiter().getMaxLinearAcceleration();

	// Calculate the strength of repulsion through inverse square law decay
	float strength = getDecayCoefficient() / distanceSqr;
	if (strength > maxAcceleration) strength = maxAcceleration;

	// Add the acceleration
	// Optimized code for linear.mulAdd(toAgent.nor(), strength);
	linear.mulAdd(toAgent, strength / (float)Math.sqrt(distanceSqr));

	return true;
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:18,代码来源:Separation.java


示例5: reportNeighbor

import com.badlogic.gdx.ai.steer.Steerable; //导入依赖的package包/类
@Override
public boolean reportNeighbor (Steerable<T> neighbor) {
	// Calculate the position of the hiding spot for this obstacle
	T hidingSpot = getHidingPosition(neighbor.getPosition(), neighbor.getBoundingRadius(), target.getPosition());

	// Work in distance-squared space to find the closest hiding
	// spot to the owner
	float distance2 = hidingSpot.dst2(owner.getPosition());
	if (distance2 < distance2ToClosest) {
		distance2ToClosest = distance2;
		bestHidingSpot.set(hidingSpot);
		return true;
	}

	return false;
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:17,代码来源:Hide.java


示例6: applyConfigs

import com.badlogic.gdx.ai.steer.Steerable; //导入依赖的package包/类
@Override
public void applyConfigs(SteeringBehaviorComponent steeringBC) {
    Pursue pursue = (Pursue)steeringBC.behavior;
    Steerable steerable = pursue.getOwner();
    steerable.setMaxLinearSpeed(MAX_LINEAR_SPEED);
    steerable.setMaxLinearAcceleration(MAX_LINEAR_ACCELERATION);
    steerable.setMaxAngularSpeed(MAX_ANGULAR_SPEED);
    steerable.setMaxAngularAcceleration(MAX_ANGULAR_ACCELERATION);
    pursue.setMaxPredictionTime(0.85f);


}
 
开发者ID:unlimitedggames,项目名称:gdxjam-ugg,代码行数:13,代码来源:EnemyPursueConfig.java


示例7: RayConfigurationBase

import com.badlogic.gdx.ai.steer.Steerable; //导入依赖的package包/类
/** Creates a {@code RayConfigurationBase} for the given owner and the specified number of rays.
 * @param owner the owner of this configuration
 * @param numRays the number of rays used by this configuration */
@SuppressWarnings("unchecked")
public RayConfigurationBase (Steerable<T> owner, int numRays) {
	this.owner = owner;
	this.rays = new Ray[numRays];
	for (int i = 0; i < numRays; i++)
		this.rays[i] = new Ray<T>(owner.getPosition().cpy().setZero(), owner.getPosition().cpy().setZero());
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:11,代码来源:RayConfigurationBase.java


示例8: applyConfigs

import com.badlogic.gdx.ai.steer.Steerable; //导入依赖的package包/类
@Override
public void applyConfigs(SteeringBehaviorComponent steeringBC) {
    Seek seek = (Seek)steeringBC.behavior;
    Steerable steerable = seek.getOwner();
    steerable.setMaxLinearSpeed(MAX_LINEAR_SPEED);
    steerable.setMaxLinearAcceleration(MAX_LINEAR_ACCELERATION);
    steerable.setMaxAngularSpeed(MAX_ANGULAR_SPEED);
    steerable.setMaxAngularAcceleration(MAX_ANGULAR_ACCELERATION);

}
 
开发者ID:unlimitedggames,项目名称:gdxjam-ugg,代码行数:11,代码来源:EnemySeekConfig.java


示例9: applyConfigs

import com.badlogic.gdx.ai.steer.Steerable; //导入依赖的package包/类
@Override
public void applyConfigs(SteeringBehaviorComponent steeringBC) {
    Pursue pursue = (Pursue)steeringBC.behavior;
    Steerable steerable = pursue.getOwner();
    steerable.setMaxLinearSpeed(MAX_LINEAR_SPEED);
    steerable.setMaxLinearAcceleration(MAX_LINEAR_ACCELERATION);
    steerable.setMaxAngularSpeed(MAX_ANGULAR_SPEED);
    steerable.setMaxAngularAcceleration(MAX_ANGULAR_ACCELERATION);

}
 
开发者ID:unlimitedggames,项目名称:gdxjam-ugg,代码行数:11,代码来源:EnemyFacePursueConfig.java


示例10: applyConfigs

import com.badlogic.gdx.ai.steer.Steerable; //导入依赖的package包/类
@Override
public void applyConfigs(SteeringBehaviorComponent steeringBC) {
    Arrive arrive = (Arrive)steeringBC.behavior;
    Steerable steerable = arrive.getOwner();
    steerable.setMaxLinearSpeed(MAX_LINEAR_SPEED);
    steerable.setMaxLinearAcceleration(MAX_LINEAR_ACCELERATION);
    steerable.setMaxAngularSpeed(MAX_ANGULAR_SPEED);
    steerable.setMaxAngularAcceleration(MAX_ANGULAR_ACCELERATION);

    arrive.setArrivalTolerance(0.5f);
    arrive.setDecelerationRadius(10f);
    arrive.setTimeToTarget(0.005f);
}
 
开发者ID:unlimitedggames,项目名称:gdxjam-ugg,代码行数:14,代码来源:EnemyArriveConfig.java


示例11: createArrive

import com.badlogic.gdx.ai.steer.Steerable; //导入依赖的package包/类
public static Arrive createArrive(float x, float y, Steerable steerable){
    SteerLocation loc = new SteerLocation();
    loc.getPosition().set(x, y);
    Arrive arrive = new Arrive(steerable, loc);
        arrive.setTarget(loc);

    arrive.setOwner(steerable);
    return arrive;
}
 
开发者ID:unlimitedggames,项目名称:gdxjam-ugg,代码行数:10,代码来源:BehaviorUtils.java


示例12: CentralRayWithWhiskersConfiguration

import com.badlogic.gdx.ai.steer.Steerable; //导入依赖的package包/类
/** Creates a {@code CentralRayWithWhiskersConfiguration} for the given owner where the central ray has the specified length and
 * the two whiskers have the specified length and angle.
 * @param owner the owner of this configuration
 * @param rayLength the length of the central ray
 * @param whiskerLength the length of the two whiskers (usually shorter than the central ray)
 * @param whiskerAngle the angle in radians of the whiskers from the central ray */
public CentralRayWithWhiskersConfiguration (Steerable<T> owner, float rayLength, float whiskerLength, float whiskerAngle) {
	super(owner, 3);
	this.rayLength = rayLength;
	this.whiskerLength = whiskerLength;
	this.whiskerAngle = whiskerAngle;
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:13,代码来源:CentralRayWithWhiskersConfiguration.java


示例13: FieldOfViewProximity

import com.badlogic.gdx.ai.steer.Steerable; //导入依赖的package包/类
/** Creates a {@code FieldOfViewProximity} for the specified owner, agents and cone area defined by the given radius and angle
 * in radians.
 * @param owner the owner of this proximity
 * @param agents the agents
 * @param radius the radius of the cone area
 * @param angle the angle in radians of the cone area */
public FieldOfViewProximity (Steerable<T> owner, Iterable<? extends Steerable<T>> agents, float radius, float angle) {
	super(owner, agents);
	this.radius = radius;
	setAngle(angle);
	this.lastTime = 0;
	this.ownerOrientation = owner.getPosition().cpy().setZero();
	this.toAgent = owner.getPosition().cpy().setZero();
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:15,代码来源:FieldOfViewProximity.java


示例14: findNeighbors

import com.badlogic.gdx.ai.steer.Steerable; //导入依赖的package包/类
@Override
public int findNeighbors (ProximityCallback<T> callback) {
	int neighborCount = 0;
	for (Steerable<T> currentAgent : agents) {
		// Make sure the agent being examined isn't the owner
		if (currentAgent != owner) {
			if (callback.reportNeighbor(currentAgent)) {
				neighborCount++;
			}
		}
	}

	return neighborCount;
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:15,代码来源:InfiniteProximity.java


示例15: Interpose

import com.badlogic.gdx.ai.steer.Steerable; //导入依赖的package包/类
/** Creates an {@code Interpose} behavior for the specified owner and agents using the the given interposing ratio.
 * @param owner the owner of this behavior
 * @param agentA the first agent
 * @param agentB the other agent
 * @param interpositionRatio a number between 0 and 1 indicating the percentage of the distance between the 2 agents that the
 *           owner should reach, where 0 is agentA position and 1 is agentB position. */
public Interpose (Steerable<T> owner, Steerable<T> agentA, Steerable<T> agentB, float interpositionRatio) {
	super(owner);
	this.agentA = agentA;
	this.agentB = agentB;
	this.interpositionRatio = interpositionRatio;

	this.internalTargetPosition = newVector(owner);
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:15,代码来源:Interpose.java


示例16: RaycastObstacleAvoidance

import com.badlogic.gdx.ai.steer.Steerable; //导入依赖的package包/类
/** Creates a {@code RaycastObstacleAvoidance} behavior.
 * @param owner the owner of this behavior
 * @param rayConfiguration the ray configuration
 * @param raycastCollisionDetector the collision detector
 * @param distanceFromBoundary the minimum distance to a wall (i.e., how far to avoid collision). */
public RaycastObstacleAvoidance (Steerable<T> owner, RayConfiguration<T> rayConfiguration,
	RaycastCollisionDetector<T> raycastCollisionDetector, float distanceFromBoundary) {
	super(owner);
	this.rayConfiguration = rayConfiguration;
	this.raycastCollisionDetector = raycastCollisionDetector;
	this.distanceFromBoundary = distanceFromBoundary;

	this.outputCollision = new Collision<T>(newVector(owner), newVector(owner));
	this.minOutputCollision = new Collision<T>(newVector(owner), newVector(owner));
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:16,代码来源:RaycastObstacleAvoidance.java


示例17: CollisionAvoidance

import com.badlogic.gdx.ai.steer.Steerable; //导入依赖的package包/类
/** Creates a {@code CollisionAvoidance} behavior for the specified owner and proximity.
 * @param owner the owner of this behavior
 * @param proximity the proximity of this behavior. */
public CollisionAvoidance (Steerable<T> owner, Proximity<T> proximity) {
	super(owner, proximity);

	this.firstRelativePosition = newVector(owner);
	this.firstRelativeVelocity = newVector(owner);

	this.relativeVelocity = newVector(owner);
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:12,代码来源:CollisionAvoidance.java


示例18: reportNeighbor

import com.badlogic.gdx.ai.steer.Steerable; //导入依赖的package包/类
@Override
public boolean reportNeighbor (Steerable<T> neighbor) {
	// Calculate the time to collision
	relativePosition.set(neighbor.getPosition()).sub(owner.getPosition());
	relativeVelocity.set(neighbor.getLinearVelocity()).sub(owner.getLinearVelocity());
	float relativeSpeed2 = relativeVelocity.len2();

	// Collision can't happen when the agents have the same linear velocity.
	// Also, note that timeToCollision would be NaN due to the indeterminate form 0/0 and,
	// since any comparison involving NaN returns false, it would become the shortestTime,
	// so defeating the algorithm.
	if (relativeSpeed2 == 0) return false;
	
	float timeToCollision = -relativePosition.dot(relativeVelocity) / relativeSpeed2;

	// If timeToCollision is negative, i.e. the owner is already moving away from the the neighbor,
	// or it's not the most imminent collision then no action needs to be taken.
	if (timeToCollision <= 0 || timeToCollision >= shortestTime) return false;

	// Check if it is going to be a collision at all
	float distance = relativePosition.len();
	float minSeparation = distance - (float)Math.sqrt(relativeSpeed2) * timeToCollision /* shortestTime */;
	if (minSeparation > owner.getBoundingRadius() + neighbor.getBoundingRadius()) return false;

	// Store most imminent collision data
	shortestTime = timeToCollision;
	firstNeighbor = neighbor;
	firstMinSeparation = minSeparation;
	firstDistance = distance;
	firstRelativePosition.set(relativePosition);
	firstRelativeVelocity.set(relativeVelocity);

	return true;
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:35,代码来源:CollisionAvoidance.java


示例19: BlendedSteering

import com.badlogic.gdx.ai.steer.Steerable; //导入依赖的package包/类
/** Creates a {@code BlendedSteering} for the specified {@code owner}, {@code maxLinearAcceleration} and
 * {@code maxAngularAcceleration}.
 * @param owner the owner of this behavior. */
public BlendedSteering (Steerable<T> owner) {
	super(owner);

	this.list = new Array<BehaviorAndWeight<T>>();
	this.steering = new SteeringAcceleration<T>(newVector(owner));
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:10,代码来源:BlendedSteering.java


示例20: FollowPath

import com.badlogic.gdx.ai.steer.Steerable; //导入依赖的package包/类
/** Creates a {@code FollowPath} behavior for the specified owner, path, path offset, maximum linear acceleration and prediction
 * time.
 * @param owner the owner of this behavior
 * @param path the path to be followed by the owner
 * @param pathOffset the distance along the path to generate the target. Can be negative if the owner is to move along the
 *           reverse direction.
 * @param predictionTime the time in the future to predict the owner's position. Can be 0 for non-predictive path following. */
public FollowPath (Steerable<T> owner, Path<T, P> path, float pathOffset, float predictionTime) {
	super(owner);
	this.path = path;
	this.pathParam = path.createParam();
	this.pathOffset = pathOffset;
	this.predictionTime = predictionTime;

	this.arriveEnabled = true;

	this.internalTargetPosition = newVector(owner);
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:19,代码来源:FollowPath.java



注:本文中的com.badlogic.gdx.ai.steer.Steerable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ProviderUpdateByExampleSelectiveMethodGenerator类代码示例发布时间:2022-05-22
下一篇:
Java Entry3类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap