# Rotating a helix

Discussion in 'Spigot Plugin Help' started by Saday17, Jun 27, 2018.

I understand, for the most part, how to create a helix based on a players current location. I have been doing loads of research about rotating that helix based on a players yaw and pitch and found nearly nothing on that. Anyone able to help?

Still have not been able to find the answer. Any references to where I can find help would be lovely.

3. ### HazeDev

I might be able to help and idk if this is a stupid question but what exactly is a helix?

It's similar to the shape of DNA, except DNA is a double-helix connected with rungs.

5. ### HazeDev

I have been to this page several times, I understand how to make a helix, but not how to incorporate yaw and pitch in order to rotate it to the players looking direction.

8. ### HazeDev

So if i understand, You want the helix to travel in the direction the player is facing?

Yes, that is definately the intent.

10. ### HazeDev

This has really interested me and I'm going to look deeper into it.
I think that the pitch wont be too complicated because that only affects the Y coordinate but the pitch will be harder because it affects the X and Z coordinate.
I'll reply again when I have done some maths and stuff.

Alright thank you for your assistance.

12. ### HazeDev

in your code, You have a for loop and inside it you spawn the particle of the helix.
Does this spawn all of them at once at the end of the method or do you see the particles spawning one by one?

It spawns them one at a time, but since it is a for loop it spawns too fast for you to be able to tell.

14. ### HazeDev

Yeah i sorted that,
You have to run the method asyncrously, so basically in a BukkitRunnable then use runTaskAsynchronously, then in the for loop use Thread.sleep(50) to give a space between each spawn.
One thing I still can't manage is to get the "helix" travel in the direction the player is facing, I have spent a lot of time on it and it's really a tough problem. If you have discord I'd like to share my work so far with you.
(I've done alot of trigonometry work on paper and it seems like it should work but when i put it into mc it just doesn't and i can't understand why..)

#14
Last edited: Jun 28, 2018

17. ### Mareckoo01

I don't see any reason why the method should be static and why you use Thread.sleep() instead of repeating task that changes the values every iteration..
But, did you take a look at Sin & Cos, Radians, Sphere, Polygon, Rotation, Lines ?

• Like x 1
18. ### Heraldry

Theee tutorials are certainly the best, they helped me get through learning how to rotate my helix effect, if you’d like help (I’ve got the code for this pm me and I’ll guide you through it) however I won’t be in until later

19. ### Mareckoo01

I'm not that good at math but i decided to play with particles a bit and wrote this.
It makes rainbow rotating particle line(s), you can use it if you want..
You could also add min&max radius and have it shrink/expand from start to end or in some shape..
But keep in mind that those calculations are heavy.