diff options
author | DevToaster <blazetoaster@gmail.com> | 2015-03-31 17:03:35 +0200 |
---|---|---|
committer | DevToaster <blazetoaster@gmail.com> | 2015-03-31 17:03:35 +0200 |
commit | 45c84ea93318a4ab8921a20d7d2c086cfc313999 (patch) | |
tree | 2e802814ec3da8fa341e9ad73a588f01fd4b5e2d /src/Entities | |
parent | Adjusted projectile physics (diff) | |
download | cuberite-45c84ea93318a4ab8921a20d7d2c086cfc313999.tar cuberite-45c84ea93318a4ab8921a20d7d2c086cfc313999.tar.gz cuberite-45c84ea93318a4ab8921a20d7d2c086cfc313999.tar.bz2 cuberite-45c84ea93318a4ab8921a20d7d2c086cfc313999.tar.lz cuberite-45c84ea93318a4ab8921a20d7d2c086cfc313999.tar.xz cuberite-45c84ea93318a4ab8921a20d7d2c086cfc313999.tar.zst cuberite-45c84ea93318a4ab8921a20d7d2c086cfc313999.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/ArrowEntity.cpp | 2 | ||||
-rw-r--r-- | src/Entities/Boat.cpp | 2 | ||||
-rw-r--r-- | src/Entities/Entity.cpp | 4 | ||||
-rw-r--r-- | src/Entities/Entity.h | 6 | ||||
-rw-r--r-- | src/Entities/FallingBlock.cpp | 2 | ||||
-rw-r--r-- | src/Entities/Minecart.cpp | 2 | ||||
-rw-r--r-- | src/Entities/Pawn.cpp | 2 | ||||
-rw-r--r-- | src/Entities/ProjectileEntity.cpp | 6 | ||||
-rw-r--r-- | src/Entities/TNTEntity.cpp | 2 |
9 files changed, 15 insertions, 13 deletions
diff --git a/src/Entities/ArrowEntity.cpp b/src/Entities/ArrowEntity.cpp index 3516b7540..32952100c 100644 --- a/src/Entities/ArrowEntity.cpp +++ b/src/Entities/ArrowEntity.cpp @@ -51,7 +51,7 @@ cArrowEntity::cArrowEntity(cPlayer & a_Player, double a_Force) : m_PickupState = psInCreative; } SetGravity(-20.0f); - SetAirDrag(0.2f); + SetAirDrag(0.01f); } diff --git a/src/Entities/Boat.cpp b/src/Entities/Boat.cpp index 8899921ab..4ad418be4 100644 --- a/src/Entities/Boat.cpp +++ b/src/Entities/Boat.cpp @@ -18,7 +18,7 @@ cBoat::cBoat(double a_X, double a_Y, double a_Z) : { SetMass(20.0f); SetGravity(-16.0f); - SetAirDrag(1.0f); + SetAirDrag(0.05f); SetMaxHealth(6); SetHealth(6); } diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 67dae44b2..51cee248e 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -36,7 +36,7 @@ cEntity::cEntity(eEntityType a_EntityType, double a_X, double a_Y, double a_Z, d m_bHasSentNoSpeed(true), m_bOnGround(false), m_Gravity(-9.81f), - m_AirDrag(0.4f), + m_AirDrag(0.02f), m_LastPos(a_X, a_Y, a_Z), m_IsInitialized(false), m_WorldTravellingFrom(nullptr), @@ -944,7 +944,7 @@ void cEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { // Normal gravity fallspeed = m_Gravity * DtSec.count(); - NextSpeed -= NextSpeed * m_AirDrag * DtSec.count(); + NextSpeed -= NextSpeed * (m_AirDrag * 20.0f) * DtSec.count(); } NextSpeed.y += static_cast<float>(fallspeed); } diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 2c994c550..dd6190ced 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -508,8 +508,10 @@ protected: For realistic effects, this should be negative. For spaaaaaaace, this can be zero or even positive */ float m_Gravity; - /** Stores the air drag that is applied to the entity every tick, measured in speed ratio per second - Acts as air friction and slows down flight */ + /** Stores the air drag that is applied to the entity every tick, measured in speed ratio per tick + Acts as air friction and slows down flight + Will be interpolated if the server tick rate varies + Data: http://minecraft.gamepedia.com/Entity#Motion_of_entities */ float m_AirDrag; /** Last position sent to client via the Relative Move or Teleport packets (not Velocity) diff --git a/src/Entities/FallingBlock.cpp b/src/Entities/FallingBlock.cpp index 82daeb4bf..4a165909a 100644 --- a/src/Entities/FallingBlock.cpp +++ b/src/Entities/FallingBlock.cpp @@ -17,7 +17,7 @@ cFallingBlock::cFallingBlock(const Vector3i & a_BlockPosition, BLOCKTYPE a_Block m_OriginalPosition(a_BlockPosition) { SetGravity(-16.0f); - SetAirDrag(0.4f); + SetAirDrag(0.02f); } diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp index 7fdb39ea7..3d56570ba 100644 --- a/src/Entities/Minecart.cpp +++ b/src/Entities/Minecart.cpp @@ -94,7 +94,7 @@ cMinecart::cMinecart(ePayload a_Payload, double a_X, double a_Y, double a_Z) : { SetMass(20.0f); SetGravity(-16.0f); - SetAirDrag(1.0f); + SetAirDrag(0.05f); SetMaxHealth(6); SetHealth(6); SetWidth(1); diff --git a/src/Entities/Pawn.cpp b/src/Entities/Pawn.cpp index a4a9c6f21..fcb686e28 100644 --- a/src/Entities/Pawn.cpp +++ b/src/Entities/Pawn.cpp @@ -14,7 +14,7 @@ cPawn::cPawn(eEntityType a_EntityType, double a_Width, double a_Height) : , m_EntityEffects(tEffectMap()) { SetGravity(-32.0f); - SetAirDrag(0.4f); + SetAirDrag(0.02f); } diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp index 28f7d0dea..05b7669cd 100644 --- a/src/Entities/ProjectileEntity.cpp +++ b/src/Entities/ProjectileEntity.cpp @@ -228,7 +228,7 @@ cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, double a m_IsInGround(false) { SetGravity(-12.0f); - SetAirDrag(0.2f); + SetAirDrag(0.01f); } @@ -245,7 +245,7 @@ cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, const Ve SetYawFromSpeed(); SetPitchFromSpeed(); SetGravity(-12.0f); - SetAirDrag(0.2f); + SetAirDrag(0.01f); } @@ -395,7 +395,7 @@ void cProjectileEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a // Add slowdown and gravity effect to the speed: Vector3d NewSpeed(GetSpeed()); NewSpeed.y += m_Gravity * DtSec.count(); - NewSpeed -= NewSpeed * m_AirDrag * DtSec.count(); + NewSpeed -= NewSpeed * (m_AirDrag * 20.0f) * DtSec.count(); SetSpeed(NewSpeed); SetYawFromSpeed(); SetPitchFromSpeed(); diff --git a/src/Entities/TNTEntity.cpp b/src/Entities/TNTEntity.cpp index b5b98f833..d849bd4c9 100644 --- a/src/Entities/TNTEntity.cpp +++ b/src/Entities/TNTEntity.cpp @@ -13,7 +13,7 @@ cTNTEntity::cTNTEntity(double a_X, double a_Y, double a_Z, int a_FuseTicks) : m_FuseTicks(a_FuseTicks) { SetGravity(-16.0f); - SetAirDrag(0.4f); + SetAirDrag(0.02f); } |