← Back to all addons

Orbital Attacks (Clash Bandicoot Style) πŸͺ

Posted by Mr.Titan on Sep 13, 2025 at 2:29 AM

Feature
eyesshaking 5 πŸ’‘ 1 πŸ”₯ 1

Make a projectile orbit around the emitter.

First folllow this tutorial, there’s dependencies here https://discord.com/channels/1090763611938496553/1416232520881803364

In file “ProjectileAbility.cs”

in method ThrowProjectile, bellow:

    // base spawn position
    Vector3 spawnPos = m_projectileSpawnPoint.position;

     YOUR CODE WILL GO HERE

Add the following

    //orbit will position to the center of the emitter
    if (activeAbilitySheet.orbitAroundEmitter)
    {
        spawnPos = m_character.transform.position;
    }

In file “ProjectileAbilitySheet.cs”

Addd the following on top:

        [SerializeField] private bool m_orbitAroundEmitter = false;
        public bool orbitAroundEmitter => m_orbitAroundEmitter;

continnue in the comments…..

In the file “Projectile.cs”

Add the following properties bellow:

private bool m_operating = false;

//NEWCODE GOES HERE

Add the following:

        private bool m_orbiting = false;
        private float m_currentAngle;
        private float m_orbitRadius;

Update method “Throw”

Bellow the following

m_operating = true;

//ADD THE CODE HERE

Add the following:

            //orbit
            m_orbiting = abilitySheet.orbitAroundEmitter;
            if (m_orbiting && m_source != null)
            {
                Vector3 offset = transform.position - m_source.transform.position;
                m_orbitRadius = offset.magnitude; // distance from player
                m_currentAngle = Mathf.Atan2(offset.y, offset.x); // radians!
            }

Replace all the method “FixedUpdate()” with the following

private void FixedUpdate()
{
    if (m_orbiting && m_source != null)
    {
        // advance orbit angle
        float direction = m_reverseRotation ? -1f : 1f;
        m_currentAngle += m_speed * direction * Time.fixedDeltaTime;

        // compute new orbit position
        Vector3 orbitCenter = m_source.transform.position;
        float x = Mathf.Cos(m_currentAngle) * m_orbitRadius;
        float y = Mathf.Sin(m_currentAngle) * m_orbitRadius;
        transform.position = orbitCenter + new Vector3(x, y, 0f);

        // optional: face tangent to orbit path
        Vector3 tangent = new Vector3(-Mathf.Sin(m_currentAngle), Mathf.Cos(m_currentAngle), 0f) * direction;
        transform.rotation = Quaternion.LookRotation(Vector3.forward, tangent);

        // stop rigidbody pushing it away
        m_rigidbody.linearVelocity = Vector2.zero;
    }
    else
    {
        // normal projectile behavior
        transform.rotation = Quaternion.LookRotation(Vector3.forward, m_direction * (m_reverseRotation ? -1f : 1f));
        m_rigidbody.linearVelocity =
            m_operating ?
            m_direction * m_speed :
            Vector2.zero;
    }
}

#Finalize That it now for the configurations i recomend changing the projectile prefab in the “Projectile” component to have more time before auto explode.

Here’s the configuration for the ability in the video:

Orbital Attacks (Clash Bandicoot Style) πŸͺ

πŸ’¬ Comments (11)

8Bit Rpg Sep 17, 2025 at 08:29 PM
@Mr.Titan Hey, these addons are great! But in this one maybe you missed adding the orbitAroundEmitter somewhere in the tutorial? Because I’m getting an error saying it doesn’t contain a definition in the projectile ability sheet.
8Bit Rpg Sep 17, 2025 at 08:30 PM
And I followed the previous tutorial with the dependencies, which worked perfectly, but with this one, I’m getting that error. Thanks in advance!
Mr.Titan Sep 17, 2025 at 08:31 PM
I apreciate it a lot!
❀️ 1
Mr.Titan Sep 17, 2025 at 08:31 PM
Now what exactly is the error?
8Bit Rpg Sep 17, 2025 at 08:32 PM
Mr.Titan Sep 17, 2025 at 08:35 PM
Updated. I missed that script, by bad!
Mr.Titan Sep 17, 2025 at 08:36 PM
Try it now pelase
❀️ 1
8Bit Rpg Sep 17, 2025 at 08:49 PM
Hey, it’s working perfectly now! Thanks for the help ❀️ 🐾
8Bit Rpg Sep 17, 2025 at 10:28 PM
πŸ”₯ 1
Mr.Titan Sep 18, 2025 at 09:33 AM
Wow its looking cool πŸ‘ΎπŸ‘Ύ
❀️ 1
Zuko Sep 19, 2025 at 02:40 PM
how you put this sand smoke atmosphere?? its awesome

Want to continue the conversation?