fix: less bugs when dashing to planted weapon
This commit is contained in:
@ -68,29 +68,11 @@ public partial class DashSystem: Node3D
|
||||
var locationAlongPath = _dashCast3D.GlobalPosition + globalSweepPath * fraction;
|
||||
|
||||
var maxPushDownDistance = 0.9f;
|
||||
var correctionProportion = (float)Mathf.Remap(CollisionNormal.Y, -0.5, -1, 0, 1);
|
||||
var correctionProportion = (float) Mathf.Remap(CollisionNormal.Y, -0.5, -1, 0, 1);
|
||||
var proportion = (float) Mathf.Remap(_dashCast3D.GlobalRotation.X, 0, 1.57, 0, 1);
|
||||
PlannedPlayerLocation = locationAlongPath + CollisionNormal * maxPushDownDistance * proportion * correctionProportion;
|
||||
}
|
||||
|
||||
public Vector3 ComputeDashLocationForPlayerShape(Vector3 location, Vector3? normal = null)
|
||||
{
|
||||
if (!normal.HasValue)
|
||||
return location;
|
||||
|
||||
var castStartLocation = location + 2 * normal.Value;
|
||||
var castEndLocation = -2 * normal.Value;
|
||||
_playerCast3D.SetGlobalPosition(castStartLocation);
|
||||
_playerCast3D.SetTargetPosition(castEndLocation);
|
||||
|
||||
if (!_playerCast3D.IsColliding())
|
||||
return castEndLocation;
|
||||
|
||||
var fraction = _playerCast3D.GetClosestCollisionSafeFraction();
|
||||
var locationAlongPath = castEndLocation * fraction;
|
||||
return castStartLocation + locationAlongPath;
|
||||
}
|
||||
|
||||
public void PrepareDash()
|
||||
{
|
||||
_dashTarget.SetVisible(false);
|
||||
|
Reference in New Issue
Block a user