fixed fps a bit a BIT not fully
parent
f71102e871
commit
3cea11c4b2
|
@ -56,7 +56,10 @@ public class Example {
|
|||
TexturedModel tModel = ModelLoader.loadModel("stall.obj", "stallTexture.png");
|
||||
tModel.getTexture().setReflectivity(1f);
|
||||
tModel.getTexture().setShineDamper(7f);
|
||||
Player entity = new Player(tModel, new Vector3f(0,0,-3),0,180f,0, new Vector3f(0.2f, 0.2f, 0.2f), 5000);
|
||||
Player entity = new Player(tModel, new Vector3f(0,0,-3),0,180f,0, new Vector3f(0.2f, 0.2f, 0.2f));
|
||||
entity.setSpeeds(0.00001f, 0.0003f);
|
||||
entity.setGravity(-0.0000000001f);
|
||||
entity.setJumpPower(0.00005f);
|
||||
ThirdPersonCamera camera = new ThirdPersonCamera(new Vector3f(0,0.1f,0), entity);
|
||||
masterRenderer = new MasterRenderer(camera);
|
||||
|
||||
|
@ -128,7 +131,7 @@ public class Example {
|
|||
|
||||
ParticleTexture particleTexture = new ParticleTexture(Loader.loadTexture("particles/smoke.png"), 8);
|
||||
|
||||
ParticleSystem system = new ParticleSystem(particleTexture, 100, 5f, 0.3f, 4, 4f);
|
||||
ParticleSystem system = new ParticleSystem(particleTexture, 100, 10f, 0.3f, 4, 3f);
|
||||
system.randomizeRotation();
|
||||
system.setDirection(new Vector3f(0,0.001f,0), 0.00001f);
|
||||
system.setLifeError(0);
|
||||
|
|
|
@ -16,7 +16,6 @@ public class Player extends Entity{
|
|||
|
||||
private static float terrainHeight = 0;
|
||||
|
||||
private double timeModifier = 1;
|
||||
|
||||
private float currentSpeed = 0;
|
||||
private float currentTurn = 0;
|
||||
|
@ -24,9 +23,8 @@ public class Player extends Entity{
|
|||
|
||||
private boolean isInAir = false;
|
||||
|
||||
public Player(TexturedModel model, Vector3f position, float rotX, float rotY, float rotZ, Vector3f scale, double timeScale) {
|
||||
public Player(TexturedModel model, Vector3f position, float rotX, float rotY, float rotZ, Vector3f scale) {
|
||||
super(model, position, rotX, rotY, rotZ, scale);
|
||||
this.timeModifier = timeScale;
|
||||
}
|
||||
|
||||
public void setSpeeds(float runSpeed, float turnSpeed) {
|
||||
|
@ -37,17 +35,21 @@ public class Player extends Entity{
|
|||
public void setJumpPower(float power) {
|
||||
JUMP_POWER = power;
|
||||
}
|
||||
|
||||
public void setGravity(float gravity) {
|
||||
GRAVITY = gravity;
|
||||
}
|
||||
|
||||
public void move(Terrain t) {
|
||||
checkInputs();
|
||||
super.increaseRotation(0, (float) ((currentTurn) * Window.getTime() / timeModifier), 0);
|
||||
float distance = (float) ((currentSpeed) * (Window.getTime() / (timeModifier * 2.5)));
|
||||
super.increaseRotation(0, (float) ((currentTurn) * Window.getTime() ), 0);
|
||||
float distance = (float) ((currentSpeed) * (Window.getTime()));
|
||||
float dx = (float) (distance * Math.sin(Math.toRadians(super.getRotY())));
|
||||
float dz = (float) (distance * Math.cos(Math.toRadians(super.getRotY())));
|
||||
super.increasePosition(dx, 0, dz);
|
||||
super.increasePosition(0, (float) (upwardsSpeed * (Window.getTime() / (timeModifier * 2))), 0);
|
||||
super.increasePosition(0, (float) (upwardsSpeed * (Window.getTime())), 0);
|
||||
terrainHeight = t.getHeightOfTerrain(super.getPosition().x, super.getPosition().z);
|
||||
upwardsSpeed += GRAVITY * Window.getTime() / (timeModifier * 2);
|
||||
upwardsSpeed += GRAVITY * Window.getTime();
|
||||
if(super.getPosition().y < terrainHeight) {
|
||||
isInAir = false;
|
||||
upwardsSpeed = 0;
|
||||
|
|
|
@ -71,7 +71,7 @@ public class Particle {
|
|||
}
|
||||
|
||||
public boolean update(ThirdPersonCamera camera) {
|
||||
float time = (float) Window.getTime() / 100000000;
|
||||
float time = (float) Window.getTime() / 1000000;
|
||||
velocity.y += Player.GRAVITY * gravityEffect * time;
|
||||
Vector3f change = new Vector3f(velocity);
|
||||
change.scale((float) time);
|
||||
|
|
|
@ -21,7 +21,7 @@ public class ParticleSystem {
|
|||
private Random random = new Random();
|
||||
|
||||
public ParticleSystem(ParticleTexture texture, float pps, float speed, float gravityComplient, float lifeLength, float scale) {
|
||||
this.pps = pps;
|
||||
this.pps = pps / 100000;
|
||||
this.averageSpeed = speed;
|
||||
this.gravityComplient = gravityComplient;
|
||||
this.averageLifeLength = lifeLength;
|
||||
|
@ -67,7 +67,7 @@ public class ParticleSystem {
|
|||
}
|
||||
|
||||
public void generateParticles(Vector3f systemCenter) {
|
||||
float delta = (float) Window.getTime() / 50000000;
|
||||
float delta = (float) Window.getTime();
|
||||
float particlesToCreate = pps * delta;
|
||||
int count = (int) Math.floor(particlesToCreate);
|
||||
float partialParticle = particlesToCreate % 1;
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue