• Hello Guest! Did you know that ProjectKorra has an official Discord server? A lot of discussion about the official server, development process, and community discussion happens over there. Feel free to join now by clicking the link below.

    Join the Discord Server

Ability works in one axis only

SkepsonSk

Member
Hello guys !

I am currently trying to use mathematical forumals in my abilities and it works, but only in one axis ;(

I mean, when I trigger the ability and I'm pointing north or east - it's ok, but if not - it is bugging.

This is my progress method (currentPosition is position of the blast and movement is ... Movement):

Code:
    @Override
    public void progress() {
        
        if (player.isDead() || currentPosition.distance(origin) > 100){
            
            remove();
            return;
            
        }
        
        displayParticleEffects();
        
        time ++;
        double sin = Math.sin( time * 0.75 );
        
        currentPosition.add( movement.setX(sin) );
        
        return;
        
    }
I would be very grateful if You helped me ;)

Lots of love ;)
 

StrangeOne101

Staff member
Plugin Developer
Moderator
Code:
currentPosition.add( movement.setX(sin) );
Well for starters, what does it say here? You are only modifying the x axis, so it kind of makes sense that it will only go one way lol

But as Finn said, what are you trying to do?
 

Switch

Member
Not trying to answer any questions, but I'll make your days harder by asking one myself.
Do you use the sin() curve to do that 'zig zag' kinda motion?
 

Finn_Bueno_

Staff member
Plugin Developer

StrangeOne101

Staff member
Plugin Developer
Moderator
That's not how sin works.
Anyway, for what you're trying you're gonna have to look into 'rotation', a complex part of particle animations, especially for someone who just started.
https://www.spigotmc.org/threads/rotating-particle-effects.166854/
I advise to start with something simpler. The simplest thing I can think of that uses sin and cos is a circle. Try making a 2d circle first.
I think he's wanting a sin wave. In which he's on the right track, but he needs it to be realative to his motion vector.

@SkepsonSk I'm not any good at that myself so it's worth checking out that tutorial lol.
 
Top