Skip to content

Commit

Permalink
v1.8.2 FIXED COLLISIONS
Browse files Browse the repository at this point in the history
- Collisions are good! (Again!)
- May or may not have fixed a camera issue with replays
  • Loading branch information
Tribow committed Dec 16, 2023
1 parent 1667962 commit b7db826
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@ internal class CarLevelOfDetail__IncrementLevel
[HarmonyPostfix]
internal static void MakeSureSimulationIsOn(CarLevelOfDetail __instance)
{
if (__instance.type_ == CarLevelOfDetail.Type.Networked && Mod.Instance.Config.EnableCollision && !Mod.Instance.PlayerFinished)
if (__instance.type_ == CarLevelOfDetail.Type.Networked)
{
__instance.SetCarSimulationEnabled(true);
}
else
{
if (Mod.Instance.PlayerFinished)
if (Mod.Instance.Config.EnableCollision && !Mod.Instance.PlayerFinished)
{
__instance.SetCarSimulationEnabled(false);

if (__instance.rigidbody_.isKinematic)
__instance.SetCarSimulationEnabled(true);
}
else
{
if (Mod.Instance.PlayerFinished)
{
__instance.rigidbodyStateTransceiver_.setCarOnFixedUpdate_ = false;
__instance.rigidbody_.isKinematic = false;
if (__instance.rigidbody_.isKinematic)
{
__instance.rigidbodyStateTransceiver_.setCarOnFixedUpdate_ = false;
__instance.rigidbody_.isKinematic = false;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ System.Collections.IEnumerator ActivateCollidersAfterSeconds(float seconds)
if (!Mod.Instance.PlayerFinished)
{
__instance.SetAllColliderLayers(Layers.OnlyPlayer1);
//__instance.CarLOD_.rigidbody_.isKinematic = true;
__instance.CarLOD_.rigidbody_.isKinematic = true;
__instance.CarLOD_.SetCarSimulationEnabled(true);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ internal static bool FixedTheFixedUpdate(RigidbodyStateTransceiver __instance)
{
if (!__instance.setCarOnFixedUpdate_)
return false;
__instance.rigidbody_.transform.position = __instance.posSpring_.Pos_ + __instance.setCarOnFixedUpdateCoef_ * 0.01f * __instance.velSpring_.Pos_;
__instance.rigidbody_.transform.rotation = __instance.rotSpring_.Pos_;
__instance.rigidbody_.velocity = __instance.velSpring_.Pos_;
__instance.rigidbody_.angularVelocity = __instance.rotSpring_.Vel_;
__instance.rigidbody_.MovePosition(__instance.posSpring_.Pos_ + __instance.setCarOnFixedUpdateCoef_ * 0.01f * __instance.velSpring_.Pos_);
__instance.rigidbody_.MoveRotation(__instance.rotSpring_.Pos_);
//__instance.rigidbody_.velocity = __instance.velSpring_.Pos_;
//__instance.rigidbody_.angularVelocity = __instance.rotSpring_.Vel_;
return false;
}
}
Expand Down

0 comments on commit b7db826

Please sign in to comment.