I’m completely stumped if anyone can possibly help. i have no clue what im doing wron.g. everything works great with keyboard controls. but when i added on-screen joystick, it works, moves my character, but my projectiles are now firing from the center of my world not my characters spawn point. im not sure if its an error in my firing code or something wrong with how im using the joystick. here is the 3 chunks of my code that i believe the issue is probably in. any help would be greatly appreciated. Thank you in advance
//Character Control
CharacterController controller = GetComponent<CharacterController>();
// Rotate around y - axis
transform.Rotate(0, CrossPlatformInputManager.GetAxis("Horizontal") * rotateSpeed, 0);
transform.Rotate(0, Input.GetAxis("Horizontal") * rotateSpeed, 0);
// Move forward backward
Vector3 forward = transform.TransformDirection(Vector3.forward);
float curSpeed = speed * CrossPlatformInputManager.GetAxis("Vertical");
//float curSpeed = speed * Input.GetAxis("Vertical");
controller.SimpleMove(forward * curSpeed);
//Attack
if (MainCharacter.CUREP >= 3)
{
if (Input.GetKeyDown(“1”))
{ AttackFireball(); }
}
if (MainCharacter.CUREP >= 10)
{
if (Input.GetKeyDown(“2”))
{ AttackEBall(); }
}
if (MainCharacter.CUREP >= 50)
{
if (Input.GetKeyDown(“3”))
{ AttackBomb(); }
public void AttackFireball()
{
Transform bullit = Instantiate(Fireball, transform.Find(“spawnpoint”).transform.position, Quaternion.identity);
bullit.gameObject.tag = “ffball”;
bullit.GetComponent().AddForce(transform.forward * 2000);
MainCharacter.CUREP -= 3;
}