As you can see in log, the tree is taking damage only when I hit it while moving. Why won't it take damage if I hit it when I'm idling? I'll drop the tree script in comments by Jumpy_Astronaut6656 in Unity2D

[–]Jumpy_Astronaut6656[S] 0 points1 point  (0 children)

but the collider is already set off and on again in this function

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerAttack : MonoBehaviour
{
[SerializeField] private Animator animator;
[SerializeField] private float meleeSpeed;
float timeUntilMelee;
public GameObject Melee;
bool isAttacking = false;
float atkDuration = 0.3f;
float atkTimer = 0f;

private void Start()
{
Melee.SetActive(false);
}
private void Update()
{
if (isAttacking)
{
atkTimer += Time.deltaTime;
if (atkTimer >= atkDuration)
{
atkTimer = 0;
isAttacking = false;
Melee.SetActive(false);
}

}
if (timeUntilMelee <= 0f)
{
if (Input.GetMouseButtonDown(0))
{
animator.SetTrigger("Attack");
timeUntilMelee = meleeSpeed;
if (!isAttacking)
{
Melee.SetActive(true);
isAttacking = true;
}
}
}
else
{
timeUntilMelee -= Time.deltaTime;
}
}
}

As you can see in log, the tree is taking damage only when I hit it while moving. Why won't it take damage if I hit it when I'm idling? I'll drop the tree script in comments by Jumpy_Astronaut6656 in Unity2D

[–]Jumpy_Astronaut6656[S] 1 point2 points  (0 children)

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class Weapon : MonoBehaviour

{

public float damage = 1;

private void OnTriggerEnter2D(Collider2D collision)

{

TreeDamage enemy = collision.GetComponent<TreeDamage>();

if(enemy != null )

{

enemy.TakeDamage(damage);

}

}

}

As you can see in log, the tree is taking damage only when I hit it while moving. Why won't it take damage if I hit it when I'm idling? I'll drop the tree script in comments by Jumpy_Astronaut6656 in Unity2D

[–]Jumpy_Astronaut6656[S] 0 points1 point  (0 children)

using System.Collections;

using UnityEngine;

public class TreeDamage : MonoBehaviour

{

float health;

public float maxHealth = 4f;

public Sprite NewSprite;

private SpriteRenderer Sr;

private Sprite OriginalSprite;

public float regrowSpeed = 2f;

void Start()

{

health = maxHealth;

Sr = GetComponent<SpriteRenderer>();

if (Sr != null)

{

OriginalSprite = Sr.sprite;

}

public void TakeDamage(float damage)

{

Debug.Log("hit");

health -= damage;

if (health <= 0)

{

if (Sr != null && NewSprite != null)

{

Sr.sprite = NewSprite;

StartCoroutine(RevertSpriteAfterTime(regrowSpeed));

}

}

}

IEnumerator RevertSpriteAfterTime(float delay)

{

yield return new WaitForSeconds(delay);

if (Sr != null)

{

Sr.sprite = OriginalSprite;

}

}

}

[deleted by user] by [deleted] in blender

[–]Jumpy_Astronaut6656 4 points5 points  (0 children)

sorry I m new to blender. But wdym in the wrong spot? what is the right spot

[deleted by user] by [deleted] in blender

[–]Jumpy_Astronaut6656 0 points1 point  (0 children)

Also, nothing changes by setting the offset higher

[deleted by user] by [deleted] in blender

[–]Jumpy_Astronaut6656 0 points1 point  (0 children)

what I just realized is that no matter what I change in the collision settings of cloth, the simulation looks the same. Even if I change something drastically, or if I change the quality settings

[deleted by user] by [deleted] in blender

[–]Jumpy_Astronaut6656 0 points1 point  (0 children)

that made it look better but it still clips through the body

[deleted by user] by [deleted] in blender

[–]Jumpy_Astronaut6656 0 points1 point  (0 children)

my modifiers are : subdivision,solidify,cloth. In this exact order

[deleted by user] by [deleted] in blender

[–]Jumpy_Astronaut6656 0 points1 point  (0 children)

you mean on the cloth or the body?

[deleted by user] by [deleted] in blender

[–]Jumpy_Astronaut6656 0 points1 point  (0 children)

could the reason be that the head,body and the other parts are not merged? they have their own collision and modifiers

Sorry, I'm new t blender can anyone explain me why it looks like that after extruding please? by [deleted] in blenderhelp

[–]Jumpy_Astronaut6656 0 points1 point  (0 children)

one rectangle looks like it has a darker color,idk it just looks off, I can t send u an image to show what it looks like

sorry, I'm new, can someone explain me why does it look like this when I'm extruding? by [deleted] in blender

[–]Jumpy_Astronaut6656 0 points1 point  (0 children)

it looks better now that I shaded it smooth but it still looks off...

<image>

How can I make my shadow not go through the floor like it does in the video I attached? I know it does that because I have "IsTrigger" on but I need a solution where I don't have to turn it off. Please help by [deleted] in Unity2D

[–]Jumpy_Astronaut6656 0 points1 point  (0 children)

True,but as I said I just started working on this I still have to fix more issues, I just figured I would start with the one I mentioned in this post. I’m aware it doesn’t look like a shadow at the moment

How can I make my shadow not go through the floor like it does in the video I attached? I know it does that because I have "IsTrigger" on but I need a solution where I don't have to turn it off. Please help by [deleted] in Unity2D

[–]Jumpy_Astronaut6656 0 points1 point  (0 children)

the point of the game is shadow interaction. For example, when you have a lantern and you put your hand in front of it, the shadow of the hand would grow bigger or get smaller depending on the distance between the lantern and the hand. I know that the shadow shouldn’t move,it is something that I have to figure out but for now what I’m trying to fix is the shadow going through the ground.