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;
}
ActuatorEntity.java 文件源码
java
阅读 35
收藏 0
点赞 0
评论 0
项目:Entitas-Java
作者:
评论列表
文章目录