Jump to content

Recommended Posts

Posted

Hello I have a question. I want to display a particle that will move around a circle. Currently, my method for ticking looks like this:

@Override
public void tick() {
    super.tick();

    x = centerX + radius * Math.cos(2 * Math.PI * (age / 20f) / time);
    z = centerZ + radius * Math.sin(2 * Math.PI * (age / 20f) / time);
}

The "time" variable means the time it takes the particle to complete one circle. The problem is that changing the radius value changes the speed of the particle. I want a constant speed, independent of the radius. How can I get rid of the time variable? Ideally, the speed should be predefined. This means that regardless of the radius of the circle, the particle always moves at a fixed speed. Then "time" will be unnecessary. Is there a way? I will be grateful for your help!

Posted
4 minutes ago, perromercenary00 said:

it makes sense coze your calculatin particule position  using age as angle 
 

if you change (age / 20f) for  (age / 40f) would take 2 full seconds to complete a round 

Thanks for the answer! However, my point is to set the speed constant, not by editing the time of the entire rotation.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.