Modifica di update() per gestire moltiplicatore tempo
This commit is contained in:
@@ -49,7 +49,7 @@
|
||||
void setVel(const Vector3 Nacc);
|
||||
void setAcc(const Vector3 Nvel);
|
||||
void setTanAcc(const Vector3 Dacc);
|
||||
void step(const sf::Clock time);
|
||||
void step(const sf::Clock time, float multiplier);
|
||||
|
||||
//complesso, deve definire accelerazione e accelerazione tangenziale
|
||||
void appForce(Vector3 f, Vector3 pos);
|
||||
|
||||
@@ -85,12 +85,12 @@ void rigidbody::calcPos(const float Dtime){
|
||||
}
|
||||
}
|
||||
|
||||
void rigidbody::step(const sf::Clock time){
|
||||
void rigidbody::step(const sf::Clock time, float multiplier){
|
||||
int64_t Dtime = time.getElapsedTime().asMicroseconds();
|
||||
if (prevT == 0) prevT = Dtime;
|
||||
|
||||
|
||||
float dt = (float(Dtime) / 1000000.0) - (float(prevT) / 1000000.0);
|
||||
float dt = ((float(Dtime) / 1000000.0) - (float(prevT) / 1000000.0)) * multiplier;
|
||||
prevT = Dtime;
|
||||
|
||||
calcRot(dt);
|
||||
|
||||
Reference in New Issue
Block a user