::Hi, I have a trouble on part 3.
As the title suggests, the slash effect is not stretched to fill the attack area but only moves, the size of the effect remains the same regardless of the size of the attack area I enter in the inspector.
I followed the tutorial step by step and it seems like I didn’t do anything wrong
Below are script and videos:
void Attack()
{
timeSinceAttack += Time.deltaTime;
if (attack && timeSinceAttack >= timeBetweenAttack)
{
timeSinceAttack = 0;
anim.SetTrigger(“Attacking”);
if (yAxis < 0.5 && yAxis > -0.5 || yAxis <= -0.5 && Grounded())
{
Hit(SideAttackTransform, SideAttackArea, ref pState.recoilingX, recoilXSpeed);
Instantiate(slashEffect, SideAttackTransform);
}
else if(yAxis >= 0.5)
{
Hit(UpAttackTransform, UpAttackArea, ref pState.recoilingY, recoilYSpeed);
SlashEffectAtAngle(slashEffect, 90, UpAttackTransform);
}
else if (yAxis <= -0.5 && !Grounded())
{
Hit(DownAttackTransform, DownAttackArea, ref pState.recoilingY, recoilYSpeed);
SlashEffectAtAngle(slashEffect, -90, DownAttackTransform);
}
}
}
void SlashEffectAtAngle(GameObject _slashEffect, int _effectAngle, Transform _attackTransform)
{
_slashEffect = Instantiate(_slashEffect, _attackTransform);
_slashEffect.transform.eulerAngles = new Vector3(0, 0, _effectAngle);
_slashEffect.transform.localScale = new Vector2(transform.localScale.x, transform.localScale.y);
}
View post on imgur.com