TrackingSF3ThirdStrick added, attention la crise d'epilepsie
This commit is contained in:
43
src/engine/camera/TrackingSF3ThirdStrick.java
Normal file
43
src/engine/camera/TrackingSF3ThirdStrick.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package engine.camera;
|
||||
|
||||
import engine.Engine;
|
||||
import engine.math.Vector3f;
|
||||
import engine.object.ObjectGl;
|
||||
|
||||
public class TrackingSF3ThirdStrick implements TrackingDummy {
|
||||
|
||||
private final ObjectGl obj1;
|
||||
private final ObjectGl obj2;
|
||||
private final Engine engine;
|
||||
|
||||
/**
|
||||
* Un tracking ou les personnages "pousse" la camera
|
||||
*/
|
||||
public TrackingSF3ThirdStrick(ObjectGl obj1, ObjectGl obj2, Engine engine){
|
||||
this.obj1 = obj1;
|
||||
this.obj2 = obj2;
|
||||
this.engine = engine;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector3f getViewVector() {
|
||||
Vector3f vec = new Vector3f();
|
||||
|
||||
float viewXPos = -this.engine.getViewXPos();
|
||||
float dimension = this.engine.getCamera().getDimension();
|
||||
|
||||
ObjectGl left = obj1.getXPos() >= obj2.getXPos() ? obj2 : obj1;
|
||||
ObjectGl right = obj1.getXPos() < obj2.getXPos() ? obj2 : obj1;
|
||||
|
||||
System.out.println(viewXPos);
|
||||
|
||||
if ((right.getXPos() + right.getWidth() * right.getScalingFactor()) > viewXPos + dimension){
|
||||
vec.x = - Math.abs((right.getXPos() + right.getWidth() * right.getScalingFactor()) - (viewXPos + dimension));
|
||||
} else if (left.getXPos() < viewXPos - dimension){
|
||||
vec.x = Math.abs(left.getXPos() - (viewXPos - dimension));
|
||||
}
|
||||
|
||||
return vec;
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user