mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 01:00:44 +02:00
easier bouncing
This commit is contained in:
parent
1ec70e8170
commit
789f3231e1
1 changed files with 14 additions and 18 deletions
|
@ -29,7 +29,6 @@ var grid = [
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
easystar.setGrid(grid);
|
easystar.setGrid(grid);
|
||||||
|
|
||||||
easystar.setAcceptableTiles([0]);
|
easystar.setAcceptableTiles([0]);
|
||||||
|
@ -40,6 +39,7 @@ easystar.findPath(0, 0, 8, 0, function(path) {
|
||||||
Script.update.disconnect(tickEasyStar);
|
Script.update.disconnect(tickEasyStar);
|
||||||
} else {
|
} else {
|
||||||
print('path' + JSON.stringify(path));
|
print('path' + JSON.stringify(path));
|
||||||
|
|
||||||
convertPath(path);
|
convertPath(path);
|
||||||
Script.update.disconnect(tickEasyStar);
|
Script.update.disconnect(tickEasyStar);
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,16 @@ var playerSphere = Entities.addEntity({
|
||||||
linearDamping: 0.2
|
linearDamping: 0.2
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Script.setInterval(function(){
|
||||||
|
Entities.editEntity(playerSphere,{
|
||||||
|
velocity:{
|
||||||
|
x:0,
|
||||||
|
y:4,
|
||||||
|
z:0
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},1000)
|
||||||
|
|
||||||
var sphereProperties;
|
var sphereProperties;
|
||||||
|
|
||||||
//for keeping track of entities
|
//for keeping track of entities
|
||||||
|
@ -187,12 +197,8 @@ function updatePosition() {
|
||||||
x: currentSpherePosition.z,
|
x: currentSpherePosition.z,
|
||||||
y: sphereProperties.position.y,
|
y: sphereProperties.position.y,
|
||||||
z: currentSpherePosition.x
|
z: currentSpherePosition.x
|
||||||
},
|
|
||||||
velocity: {
|
|
||||||
x: 0,
|
|
||||||
y: velocityShaper.y,
|
|
||||||
z: 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,19 +233,9 @@ function createTweenPath(convertedPath) {
|
||||||
stepTweens[j].chain(stepTweens[j + 1]);
|
stepTweens[j].chain(stepTweens[j + 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//start the tween
|
||||||
var velocityUpTween = new TWEEN.Tween(velocityShaper).to(upVelocity, ANIMATION_DURATION).onUpdate(updatePosition);
|
|
||||||
var velocityDownTween = new TWEEN.Tween(velocityShaper).to(noVelocity, ANIMATION_DURATION).onUpdate(updatePosition);
|
|
||||||
|
|
||||||
velocityUpTween.chain(velocityDownTween);
|
|
||||||
velocityDownTween.chain(velocityUpTween);
|
|
||||||
|
|
||||||
|
|
||||||
velocityUpTween.easing(TWEEN.Easing.Linear.None)
|
|
||||||
velocityDownTween.easing(TWEEN.Easing.Back.InOut)
|
|
||||||
//start the tween
|
|
||||||
stepTweens[0].start();
|
stepTweens[0].start();
|
||||||
velocityUpTween.start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var velocityShaper = {
|
var velocityShaper = {
|
||||||
|
|
Loading…
Reference in a new issue