#Math (Merry-go-round)

1 messages · Page 1 of 1 (latest)

thick parcel
#

Hello

I’m trying to challenge myself and make a merry-go-round system in Spigot. I have a center location and a radius, and when it starts, all players are teleported to a random location in a circle (already done). But now, I want to make it that every tick, each player is applied velocity that correlates to the same speed for the player every tick, that is based on their angle and distance to the center point, in a circular motion. How would I go on to do this?

primal quartzBOT
#

<@&987246746478460948> please have a look, thanks.

#

Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#
TJ-Bot
Hello I’m trying to challenge myself and make a merry-go-round system in Spigot. I have a center location and a radius, and when it starts, all players are teleported to a random location in a circle (already done). But now, I want to make it that every t

m spot on the perimeter of the merry-go-round. I want to make it so that the players are constantly moving along the circle at a constant speed, like a real merry-go-round. Can anyone help me with the math to calculate the new location for each player every tick?

Here's what I have so far:

  • Center location: (x, y, z)
  • Radius: r

I know that I can use polar coordinates to calculate the x and z coordinates of a point on the circle given an angle theta. But how do I update this angle every tick to simulate movement along the circle? And how do I ensure that all players move at a consistent speed?

Any help would be greatly appreciated. Thank you!

Response:
To achieve this, you can use trigonometric functions to calculate the x and z coordinates of each player on the perimeter of the merry-go-round. You can update the angle theta every tick by incrementing it by a small amount to simulate movement along the circle.

To ensure that all players move at a consistent speed, you can adjust the increment value based on how fast you want them to move. For example, if you want them to move at a speed of v units per tick, you can calculate the increment as v / r, where r is the radius of your merry-go-round.

By updating the angle theta every tick and calculating the new x and z coordinates using trigonometric functions, you can achieve a realistic movement effect for your merry-go-round system in Spigot.

thick parcel
#

thanks bot

cinder pagoda
primal quartzBOT
#
TJ-Bot
The center location also has an armorstand that should rotate at the same angle as all the other players’ spin, is it just increasing its’ rotation by that same angle?

Yes, in order for the armorstand to rotate at the same angle as all the other players' spin, you can simply increase its rotation by that same angle. This can be achieved by updating the armorstand's rotation value based on the players' spin angle. You can listen for player rotation events and then apply that rotation to the armorstand.

Here is a basic outline of how you can achieve this:

  1. Listen for player rotation events.
  2. Get the rotation angle of the player.
  3. Apply this rotation angle to the armorstand.

You may need to do some additional calculations or adjustments based on your specific requirements, but this general approach should help you synchronize the armorstand's rotation with the players' spin.

If you have any specific questions or need further assistance with implementing this in Java, feel free to ask in our Java Q&A Discord server. Our community of developers will be more than happy to help you with any coding challenges you may encounter. Happy coding!

thick parcel
magic swallow
# primal quartz

Listen for player rotation events.
this doesnt even exist lmao

#

are you familiar with vector math and circular motion physics?

thick parcel
#

I understood enough of the first reply to believe I know how to make it

#

And the second reply with rotation events is whatever, i think i know how to rotate an armorstand xD

cinder pagoda
magic swallow
#

the more challenging part is calculating the velocity of the players based on the position of the armorstand and the position of the player

thick parcel
#

something

currentAngle something
velocityX = -radius * (currentAngle + Math.toRadians(5)) * Math.sin(something something)

#

I’m not at pc rn so i cant test it

thick parcel
# magic swallow the more challenging part is calculating the velocity of the players based on th...

Yeah like I want the middle armor stand to rotate, let’s say 5 degrees every tick, and let’s say player A has a X angle TO the center location, playerA should always have the same angle X towards the center, so it has to apply velocity to the player to make its’ circular motion add up to that same angle, which means players closer to the center has less velocity applied and players further away have more velocity

#

That makes sense right?

cinder pagoda
thick parcel
#

Dot

thick parcel
#

Just a matter of my brain having to brain for a moment to figure it out

cinder pagoda
cinder pagoda
thick parcel
#

tyyyy