Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Entity Movement problems (moving a entity to certain cords by adding velocity)

Featured Replies

Posted

Hi, I'm trying to make an item where when you right click on something (block or entity), it makes you jump to it.  I have all the code to get the difference in cords from the target to the player, but I need to know how much velocity to add to the player to get them to land at those cords.  It would also help if I could find the code that moves the entity (like gravity).

 

Edit:  Preferably, the launch angle would be 45 degrees.

 

Edit 2:  I could solve this with the Equations of Gravity if I new the units of an entity's motion and how minecraft's gravity works.

This is an example of where I would suggest using "brute force" rather than trying to be mathematically correct.  Doing reverse trajectory calculations can be tricky in normal physics and Minecraft physics is even weirder.

 

What I would do is to simply experiment and record the velocity (and angle if you're changing that too) necessary to hit each distance.  Then once you have all the velocities known for different distances, then in your code just create an array with those values and look it up.  Understand what I mean?

 

I guarantee that that will be much faster to code than to try to figure out all the math for a closed form calculation.  No trigonometry required!

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

  • Author

That won't work, but I am doing something similar.  I am approximating the equations with simple linear equations.

 

When I use it though, it put noClip on.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.