now im jus messin wit the cubes
This commit is contained in:
parent
907afc6577
commit
f9b18a830a
1 changed files with 7 additions and 3 deletions
|
|
@ -17,6 +17,7 @@ public class GameCore implements GameLogic {
|
|||
private final Vector3f rotatingAngle = new Vector3f(1, 1, 1);
|
||||
private float angle = 0;
|
||||
private List<Float> angles = new ArrayList<>();
|
||||
private List<Vector3f> Velocities = new ArrayList<>();
|
||||
private Actor CubeActor;
|
||||
private List<Actor> CubeActors = new ArrayList<>();
|
||||
|
||||
|
|
@ -68,9 +69,10 @@ public class GameCore implements GameLogic {
|
|||
ModelData modelData = new ModelData(modelID, meshDataList);
|
||||
List<ModelData> models = new ArrayList<>();
|
||||
models.add(modelData);
|
||||
for(int i = 0; i < 150; i++) {
|
||||
for(int i = 0; i < 100000; i++) {
|
||||
angles.add((float)Math.floor(Math.random() * 360));
|
||||
CubeActors.add(new Actor("CubeActor", modelID, new Vector3f(-4f + (float)Math.floor(Math.random() * 8), -4f + (float)Math.floor(Math.random() * 8), -2f + (float)Math.floor(Math.random() * -8))));
|
||||
Velocities.add(new Vector3f((float)(-2 + (4* Math.random())),(float)(-2 + (4* Math.random())),(float)(-2 + (4* Math.random()))));
|
||||
CubeActors.add(new Actor("CubeActor", modelID, new Vector3f(-50f + (float)Math.floor(Math.random() *100), -50f + (float)Math.floor(Math.random() * 100), -2f + (float)Math.floor(Math.random() * -100))));
|
||||
engineInstance.scene().AddActor(CubeActors.get(i));
|
||||
}
|
||||
return new InitData(models);
|
||||
|
|
@ -83,9 +85,11 @@ public class GameCore implements GameLogic {
|
|||
|
||||
@Override
|
||||
public void Update(EngineInstance engineInstance, long FrameDiffNanoSeconds) {
|
||||
float DeltaTime = (float)(FrameDiffNanoSeconds/16000000.0);
|
||||
for(int i = 0; i < angles.size(); i++) {
|
||||
angles.set(i, (angles.get(i) + 1.0f) % 360);
|
||||
angles.set(i, (angles.get(i) + 1.0f* DeltaTime) % 360);
|
||||
CubeActors.get(i).GetRotation().identity().rotateAxis((float) EngineConfig.DegToRad * angles.get(i), rotatingAngle);
|
||||
CubeActors.get(i).GetPosition().add((Velocities.get(i).x/100.0f) * DeltaTime,(Velocities.get(i).y/100.0f) * DeltaTime,(Velocities.get(i).z/100.0f) * DeltaTime);
|
||||
CubeActors.get(i).UpdateModelMatrix();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue