Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
5d59f41edc
@ -230,7 +230,6 @@ public class Engine {
|
||||
obj1,
|
||||
obj2,
|
||||
this);
|
||||
this.cameraTrackingBetweenTwoObjectGl();
|
||||
}
|
||||
|
||||
public void cameraTrackingBetweenTwoObjectGl(){
|
||||
|
@ -30,22 +30,20 @@ public class TrackingTore implements TrackingDummy {
|
||||
//Track his current position and other useful data
|
||||
float xPos = this.engine.getViewXPos();
|
||||
float dimension = this.engine.getCamera().getDimension();
|
||||
float distance = Math.abs(left.getXPos() - right.getXPos()) + right.getWidth() * right.getScalingFactor();
|
||||
float middle_point = (left.getXPos() + right.getXPos() + right.getWidth() * right.getScalingFactor()) / 2;
|
||||
float distance = Math.abs(left.getXPos() - (right.getXPos()) + right.getWidth() * right.getScalingFactor()) + 1500.0f; // Il faut un offset sinon si la distance est de 0 on a la camera qui zoom vers l'infini
|
||||
float middle_point = (left.getXPos() + (right.getXPos() + right.getWidth() * right.getScalingFactor())) / 2;
|
||||
|
||||
vec.x = -middle_point - xPos;
|
||||
this.engine.getCamera().zoom((distance / 2)/dimension);
|
||||
|
||||
if (left.getXPos() < xPos - rayonExt){
|
||||
// Il faut décaler à gauche + dezoom
|
||||
vec.x = - middle_point - xPos;
|
||||
this.rayonExt = Math.abs(left.getXPos() - xPos);
|
||||
//mtn on dezoom il faut calculer le rapport necessaire pour avoir les deux objets dans le champs
|
||||
this.engine.getCamera().zoom(distance/dimension);
|
||||
// le rayonExt augmente + dezoom
|
||||
} else if(left.getXPos() > xPos - rayonExt + offset){
|
||||
// this.engine.getCamera().zoom(dimension/distance);
|
||||
// Il faut décaler à droite + zoom
|
||||
// le rayonExt diminue + zoom
|
||||
} else if(right.getXPos() > xPos + rayonExt){
|
||||
// Il faut décaler à droite + dezoom
|
||||
// le rayonExt augmente + dezoom
|
||||
} else if(right.getXPos() < xPos + rayonExt - offset){
|
||||
// Il faut décaler à gauche + zoom
|
||||
// le rayonExt diminue + zoom
|
||||
}
|
||||
return vec;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user