本文整理汇总了Java中org.joml.Vector2f.add方法的典型用法代码示例。如果您正苦于以下问题:Java Vector2f.add方法的具体用法?Java Vector2f.add怎么用?Java Vector2f.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.joml.Vector2f
的用法示例。
在下文中一共展示了Vector2f.add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import org.joml.Vector2f; //导入方法依赖的package包/类
@Override
public void update(float delta, Window window, Camera camera, World world) {
Vector2f movement = new Vector2f();
if (window.getInput().isKeyDown(GLFW_KEY_LEFT)) {
movement.add(-10 * delta, 0);
}
if (window.getInput().isKeyDown(GLFW_KEY_RIGHT)) {
movement.add(10 * delta, 0);
}
if (window.getInput().isKeyDown(GLFW_KEY_UP)) {
movement.add(0, 10 * delta);
}
if (window.getInput().isKeyDown(GLFW_KEY_DOWN)) {
movement.add(0, -10 * delta);
}
move(movement);
if(movement.x != 0|| movement.y != 0) {
useAnimation(ANIM_WALKING);
} else {
useAnimation(ANIM_IDLE);
}
camera.getPosition().lerp(transform.pos.mul(-world.getScale(), new Vector3f()), 0.05f);
}
示例2: update
import org.joml.Vector2f; //导入方法依赖的package包/类
@Override
public void update(float delta, Window window, Camera camera, World world) {
Vector2f movement = new Vector2f();
if (window.getInput().isKeyDown(GLFW.GLFW_KEY_A)){
movement.add(-10 * delta, 0);
}
if (window.getInput().isKeyDown(GLFW.GLFW_KEY_D)){
movement.add(10 * delta, 0);
}
if (window.getInput().isKeyDown(GLFW.GLFW_KEY_W)){
movement.add(0, 10 * delta * JUMP_STRENGTH);
}
movement.add(0, -10 * delta * GRAVITATION);
move(movement);
if(movement.y > 0){
useAnimation(ANIM_JETPACK);
}else if (movement.x != 0){
useAnimation(ANIM_WALK);
}else{
useAnimation(ANIM_IDLE);
}
camera.getPosition().lerp(transform.pos.mul(-world.getScale(), new Vector3f()), 0.2f);
if (window.getInput().isKeyDown(GLFW.GLFW_KEY_SPACE)){
Rocket rocket = new Rocket(1, transform);
}
}
示例3: update
import org.joml.Vector2f; //导入方法依赖的package包/类
@Override
public void update(float delta, Window window, Camera camera, World world) {
Vector2f movement = new Vector2f();
movement.add(0,-15);
move(movement);
}
示例4: update
import org.joml.Vector2f; //导入方法依赖的package包/类
public void update(long delta){
emitRemaining -= delta;
if(emitRemaining <= 0){
emitting = false;
}
double adjustedDelta = delta / 1000d;
Vector2f velDelta = particleVelocity.mul((float)adjustedDelta, new Vector2f());
for(Particle particle : particles){
particle.position.add(velDelta);
particle.life -= delta;
if(particle.life <= 0)
toRemove.add(particle);
}
particles.removeAll(toRemove);
toRemove.clear();
if(emitting){
emitAccumulator -= delta;
if(emitAccumulator <= 0){
int toMax = (int)(emitAccumulator / emitDelta);
toMax ++;
for(int i=0;i<toMax; i++){
//amount of time the particle has died before appearing
float calcDeath = i * emitDelta;
//get a random position in the boundaries
Vector2f pos = getRandomPosition();
//add the back dated velocity
pos.add(particleVelocity.mul(calcDeath, new Vector2f()));
//add the particle to the array
particles.add(new Particle(pos, particleLife - calcDeath));
}
emitAccumulator = emitDelta;
}
}
}