本文整理汇总了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;
}
示例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;
}
示例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;
}
}
示例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;
}
};
}