summaryrefslogtreecommitdiff
path: root/core/src/sk/neuromancer/sphaera/rewrite/MovingSphere.java
blob: a79bbc84f82cb9d41cf4e779d67976ec9a9731ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package sk.neuromancer.sphaera.rewrite;

import com.badlogic.gdx.graphics.g3d.Material;

import sk.neuromancer.sphaera.interf.Moving;

public class MovingSphere extends Sphere implements Moving {
    
    private float azimuth = 0f;

    public MovingSphere() {
        super();
    }

    public MovingSphere(float radius) {
        super(radius);
    }

    public MovingSphere(float radius, Material... mat) {
        super(radius, mat);
    }

    public MovingSphere(float x, float y, float z, float radius,
            Material... mat) {
        super(x, y, z, radius, mat);
    }
    
    public MovingSphere(Sphere parent, float a, float b, float radius,
            Material... mat) {
        super(parent, a, b, radius, mat);
    }

    public MovingSphere(Sphere parent, float a, float b, float radius, float azimuth,
            Material... mat) {
        super(parent, a, b, radius, mat);
        this.azimuth = azimuth;
    }

    @Override
    public void forward(float angle){
        this.setVelocity(SphereUtils.rotateDegVelocity(getSphericalPosition(), angle, azimuth));
    }
    
    @Override
    public void back(float angle){
        this.forward(-angle);
    }
    
    @Override
    public void rotateAzimuth(float angle){
        this.azimuth+=angle;
    }

    @Override
    public void rotateLeft(float angle){
        rotateAzimuth(-angle);
    }
    
    @Override
    public void rotateRight(float angle){
        rotateAzimuth(angle);
    }
    
    public float getAzimuth() {
        return azimuth;
    }

    public void setAzimuth(float azimuth) {
        this.azimuth = azimuth;
    }

}