Hi guys,
I have the following situation in my game:
I have a matrix 6x6 and I store the player’s position in a vector2Int, as you can see in the image.
And when he is hit by a bullet, I’d to instantiate on his left, right, behind and front a gameobject. However I can’t use a vector2int to do it, I’ve already tryed to do this, but I got an error message:
private void OnTriggerEnter(Collider other)
{
if (other.transform.tag == "Player2")
{
player.Health += Healing;
Instantiate(Flame, player.GridPosition.y+1, Quaternion.identity);
Instantiate(Flame, player.GridPosition.y -1, Quaternion.identity);
Instantiate(Flame, player.GridPosition.x + 1, Quaternion.identity);
Instantiate(Flame, player.GridPosition.x - 1, Quaternion.identity);
Destroy(this.gameObject);
}
}
Is there a way that I could convert this vector2int into a vector3? How could I do it?