# Solved Make water wave

Discussion in 'Plugin Development' started by negative_codezZ, Jul 12, 2014.

Not open for further replies.
1. Offline

### negative_codezZ

Hello,
I am currently developing a fairly large, new game-mode. Within, I need to make the following: "Creates a wall of water that moves forward damaging and pushing back enemies hit. ".
I am not exactly sure how to do this since I can't figure out the math for it. If anyone could help me out with that, I would be thrilled. Thanks in advance.

2. Offline

### chasechocolate

Do you want a vertical wall or more of a wave "tunnel" effect?

#2
3. Offline

### negative_codezZ

The tunnel effect, which is unfortunately the complicated one. By the way, thanks for the fast reply.

4. Offline

### chasechocolate

ping Slikey (sorry to bother you )

This guy is really good at math, he can probably lead you in the right direction.

#4
5. Offline

### negative_codezZ

Alright. Thanks for the help

6. Offline

### Ronbo

Maybe calculate locs moving forward in a parabola with decreasing constants
i.e.
y = x^2
y = 0.5x^2
y = 0.25 x^2
and so on until it's horizontal?

#6
7. Offline

### Rocoty

I'd call trigonometry on this one.

#7
8. Offline

### negative_codezZ

I am in 8th grade. Unfortunately, I don't know MUCH about trigonometry.

9. Offline

### Slikey

chasechocolate Hey, hm.. you have to combine two functions. I'll think about it. But i have a lot to do on Hypixel at the moment. So maybe work on something and I'll come back later here.

#9
Bammerbom and chasechocolate like this.
10. Offline

Thanks.

11. Offline

#11
12. Offline

Yep

13. Offline

### nuno1212sss

negative_codezZ well do as he does design on a page and work it out this is mostly MATH not bukkit so people over @ stackoverflow may help you

#13
14. Offline

15. Offline

### Slikey

#15
rbrick, Niknea, drtshock and 6 others like this.
16. Offline

### thomasb454

#16
MCCoding and _LB like this.
17. Offline

### Slikey

Sorry, I can't. We will use it on Hypixel and this is under NDA. :/

#17
thomasb454 likes this.
18. Offline

### TheHandfish

Just mess around with a graph. Separate it into forward leaning line and backward bending line. Do this with a for loop. I'm afraid I won't be able to give you example until I get computer access on Monday.

#18
19. Offline

#19
20. Offline

### CrystalxNeth

Slikey Is that just 2 functions put together basically?

EDIT: Wait nevermind, one of the lines isn't a function so I guess this is probably a lot more complicated. What type of math did you use for this at least?

#20
21. Offline

### fireblast709

CrystalxNeth two separate functions with a bit of translation and rotation for the origin

#21
22. Offline

#22
23. Offline

### fireblast709

CrystalxNeth the drawings show two polynomial functions

#23
24. Offline

#24
25. Offline

### JBoss925

Hold on, working on the math. Just gotta figure out some parabolas and we're good to go

Lol literally just worked out those 3 equations.

EDIT by Moderator: merged posts, please use the edit button instead of double posting.

Last edited by a moderator: Jun 9, 2016
#25
26. Offline

### fireblast709

JBoss925 slikey's drawing has two arcs...

#26
27. Offline

### JBoss925

Ok, got the parabolas, just gotta somehow put them into code. Wish me luck

Yes but parabolas cannot be sideways, otherwise they are not parabolas because 1 x yields 2 y's which is a no-no. So to achieve the same effect, you must use 3.

EDIT by Moderator: merged posts, please use the edit button instead of double posting.

Last edited by a moderator: Jun 9, 2016
#27
28. Offline

### fireblast709

JBoss925 then you translate and rotate, which gives you a different origin . Where do you need 2 Ys anyway?

#28
29. Offline

### JBoss925

Haha you don't, that's why it's a problem. I thought about rotating it but I realized it be much easier to get the correct angle using different parabolas.

#29
30. Offline

### fireblast709

JBoss925 as that drawing shows, the wave as a 2D picture (basically a slice of it) uses two parabolas with each their own origin. Once you know the two functions, you calculate the positions separately, then translate and rotate the points you get to the locations in the slice

#30