How do I get my little spaceship to flip on it’s Y-Axis?

Issue

This Content is from Stack Overflow. Question asked by Brent Sheldon

Below is the code I’m using. Basically, it is a ball with the sprite of a tiny
spaceship that rotates around a ring. It has a trail renderer attached and
when I change the direction the trail comes out the top in the wrong direction.
I need to know how to flip the ship to match the trail.

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

public class BallRotation : MonoBehaviour
{
    [SerializeField] private float _speed;
    
    private void FixedUpdate()
    {
        transform.Rotate(0, 0, _speed * Time.deltaTime);
       
    }

    public void ChangeDirection()
    {
        _speed = -_speed;
    }   
}



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?