Compare commits
No commits in common. "720428c7396e969e288b68a29577177f9bea3b19" and "4b8f5fee0f83d1f7f66e0dfcc35a9675906c7e9c" have entirely different histories.
720428c739
...
4b8f5fee0f
|
@ -57,12 +57,12 @@ public class PlayerMovement : MonoBehaviour
|
||||||
{
|
{
|
||||||
if (whipAttack.IsBeingWhipped)
|
if (whipAttack.IsBeingWhipped)
|
||||||
{
|
{
|
||||||
//float sign = Vector2.Dot((whipAttack.joint.position - whipAttack.otherPlayerAttack.joint.position).normalized, movement.normalized);
|
float sign = movement.x > 0 ? 1 : -1;
|
||||||
|
if (movement.x == 0)
|
||||||
|
sign = 0;
|
||||||
Vector2 ropeDir = whipAttack.otherPlayerAttack.joint.position - whipAttack.joint.position;
|
Vector2 ropeDir = whipAttack.otherPlayerAttack.joint.position - whipAttack.joint.position;
|
||||||
Vector2 tangent = new Vector2(-ropeDir.y, ropeDir.x).normalized;
|
Vector2 tangent = new Vector2(-ropeDir.y, ropeDir.x).normalized;
|
||||||
|
rb.AddForce(tangent * whipMoveSpeed * sign);
|
||||||
rb.AddForce(Vector2.Dot(movement, tangent) * tangent * whipMoveSpeed);
|
|
||||||
rb.velocity = Vector2.ClampMagnitude(rb.velocity, maxWhipMoveSpeed);
|
rb.velocity = Vector2.ClampMagnitude(rb.velocity, maxWhipMoveSpeed);
|
||||||
}
|
}
|
||||||
else if (whipAttack.IsWhippingOtherPlayer)
|
else if (whipAttack.IsWhippingOtherPlayer)
|
||||||
|
|
Loading…
Reference in New Issue