当前位置: 首页>>代码示例>>Java>>正文


Java Transform.getPosition方法代码示例

本文整理汇总了Java中com.badlogic.gdx.physics.box2d.Transform.getPosition方法的典型用法代码示例。如果您正苦于以下问题:Java Transform.getPosition方法的具体用法?Java Transform.getPosition怎么用?Java Transform.getPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.physics.box2d.Transform的用法示例。


在下文中一共展示了Transform.getPosition方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addCameraActuator

import com.badlogic.gdx.physics.box2d.Transform; //导入方法依赖的package包/类
public ActuatorEntity addCameraActuator(Camera camera, short height,
		float damping, float minDistanceX, float minDistanceY,
		String followTagEntity) {
	CameraActuator component = (CameraActuator) recoverComponent(ActuatorComponentsLookup.CameraActuator);
	if (component == null) {
		component = new CameraActuator(camera, height, damping,
				minDistanceX, minDistanceY, followTagEntity);
	} else {
		component.actuator = (indexOwner) -> {
			Set<GameEntity> followEntities = Indexed
					.getTagEntities(followTagEntity);
			for (GameEntity followEntity : followEntities) {
				RigidBody rc = followEntity.getRigidBody();
				Transform transform = rc.body.getTransform();
				Vector3 position = camera.position;
				position.x += (transform.getPosition().x + minDistanceX - position.x)
						* damping;
				position.y += (transform.getPosition().y + minDistanceY - position.y)
						* height;
			}
		};
	}
	addComponent(ActuatorComponentsLookup.CameraActuator, component);
	return this;
}
 
开发者ID:Rubentxu,项目名称:Entitas-Java,代码行数:26,代码来源:ActuatorEntity.java

示例2: replaceCameraActuator

import com.badlogic.gdx.physics.box2d.Transform; //导入方法依赖的package包/类
public ActuatorEntity replaceCameraActuator(Camera camera, short height,
		float damping, float minDistanceX, float minDistanceY,
		String followTagEntity) {
	CameraActuator component = (CameraActuator) recoverComponent(ActuatorComponentsLookup.CameraActuator);
	if (component == null) {
		component = new CameraActuator(camera, height, damping,
				minDistanceX, minDistanceY, followTagEntity);
	} else {
		component.actuator = (indexOwner) -> {
			Set<GameEntity> followEntities = Indexed
					.getTagEntities(followTagEntity);
			for (GameEntity followEntity : followEntities) {
				RigidBody rc = followEntity.getRigidBody();
				Transform transform = rc.body.getTransform();
				Vector3 position = camera.position;
				position.x += (transform.getPosition().x + minDistanceX - position.x)
						* damping;
				position.y += (transform.getPosition().y + minDistanceY - position.y)
						* height;
			}
		};
	}
	replaceComponent(ActuatorComponentsLookup.CameraActuator, component);
	return this;
}
 
开发者ID:Rubentxu,项目名称:Entitas-Java,代码行数:26,代码来源:ActuatorEntity.java

示例3: processActuator

import com.badlogic.gdx.physics.box2d.Transform; //导入方法依赖的package包/类
@Override
public void processActuator(CameraActuator actuator, float deltaTime) {
    Entity target = null;
    if(actuator.followEntity != null)
        target = actuator.followEntity;
    else if(actuator.followTagEntity != null)
        actuator.followEntity = target = engine.getEntities(actuator.followTagEntity).first();

    if(target != null) {
        RigidBodiesComponents rc = target.getComponent(RigidBodiesComponents.class);
        Transform transform = rc.rigidBodies.first().getTransform();
        Vector3 position = actuator.camera.position;
        position.x += (transform.getPosition().x - position.x) * actuator.damping;
        position.y += (transform.getPosition().y - position.y) * actuator.damping;
    }

}
 
开发者ID:Rubentxu,项目名称:GDX-Logic-Bricks,代码行数:18,代码来源:CameraActuatorSystem.java

示例4: CameraActuator

import com.badlogic.gdx.physics.box2d.Transform; //导入方法依赖的package包/类
public CameraActuator(Camera camera, short height, float damping, float minDistanceX, float minDistanceY, String followTagEntity) {
    this.actuator = (indexOwner) -> {
        Set<GameEntity> followEntities = Indexed.getTagEntities(followTagEntity);
        for (GameEntity followEntity : followEntities) {
            RigidBody rc = followEntity.getRigidBody();
            Transform transform = rc.body.getTransform();
            Vector3 position = camera.position;
            position.x += (transform.getPosition().x + minDistanceX - position.x) * damping;
            position.y += (transform.getPosition().y + minDistanceY - position.y) * height;
        }
    };

}
 
开发者ID:Rubentxu,项目名称:Entitas-Java,代码行数:14,代码来源:CameraActuator.java


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