Plant launch lerp animation
This commit is contained in:
@@ -10,6 +10,10 @@ import mindustry.type.*;
|
||||
public class PlanetParams{
|
||||
/** Camera direction relative to the planet. Length is determined by zoom. */
|
||||
public Vec3 camPos = new Vec3(0f, 0f, 4f);
|
||||
/** If not null, this is the position of the "previous" planet for smooth camera movement. */
|
||||
public @Nullable Vec3 otherCamPos;
|
||||
/** Interpolation value for otherCamPos. */
|
||||
public float otherCamAlpha = 0f;
|
||||
/** Camera up vector. */
|
||||
public Vec3 camUp = new Vec3(0f, 1f, 0f);
|
||||
/** the unit length direction vector of the camera **/
|
||||
|
||||
@@ -69,7 +69,12 @@ public class PlanetRenderer implements Disposable{
|
||||
|
||||
cam.resize(w, h);
|
||||
params.camPos.setLength((params.planet.radius + params.planet.camRadius) * camLength + (params.zoom-1f) * (params.planet.radius + params.planet.camRadius) * 2);
|
||||
cam.position.set(params.planet.position).add(params.camPos);
|
||||
|
||||
if(params.otherCamPos != null){
|
||||
cam.position.set(params.otherCamPos).lerp(params.planet.position, params.otherCamAlpha).add(params.camPos);
|
||||
}else{
|
||||
cam.position.set(params.planet.position).add(params.camPos);
|
||||
}
|
||||
//cam.up.set(params.camUp); //TODO broken
|
||||
cam.lookAt(params.planet.position);
|
||||
cam.update();
|
||||
|
||||
Reference in New Issue
Block a user