Hi!
I’m making an Avatar sort of game with bending mechanics and I have been struggling for a while now with implementing a good-looking rock throw attack. There is very little documentation about spawning things so they come out of the ground then forward so if you could shed som light on the matter please do.
The rock in question.
Here is my current script:
groundextentbounds = groundcollider.bounds.extents;
groundmaxbounds = groundcenterbounds + groundextentbounds;
groundcenterbounds = groundcollider.bounds.center;
rockextentbounds = earthcollider.bounds.extents;
rockcenterbounds = earthcollider.bounds.center;
rockmaxbounds = rockcenterbounds - rockextentbounds;
}
// Update is called once per frame
void Update()
{
SpawnLocation = player.transform.position - rockextentbounds + player.transform.forward * 5;
if (Input.GetKeyDown(KeyCode.E))
{
Instantiate(Earthrb, SpawnLocation, player.transform.rotation);
}