I have a player ship sprite that is facing upwards and a thruster particle that is facing downwards. Basically, I’m trying to figure out how to make the thruster’s position to be placed in the bottom-centre of the ship but I have no idea how. Also, how do I make the thruster rotate according to the rotation of the player so that it always faces the correct way whenever the player rotates? I have a screenshot below if you need visualisation on what I’m trying to achieve and the code I’m working on.
using UnityEngine;
using System.Collections;
public class ThrusterController : MonoBehaviour
{
public SpriteRenderer player;
private bool isThrust = false;
void Update()
{
var em = gameObject.GetComponent<ParticleSystem>().emission;
// Thruster on/off
if (Input.GetKey(KeyCode.Space) && isThrust == false)
{
isThrust = true;
em.enabled = true;
}
else
{
isThrust = false;
em.enabled = false;
}
}
}
Screenshot: