AskHow1248 Posted May 27, 2014 Posted May 27, 2014 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. Quote
jabelar Posted May 27, 2014 Posted May 27, 2014 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! Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/
AskHow1248 Posted May 27, 2014 Author Posted May 27, 2014 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. Quote
jabelar Posted May 28, 2014 Posted May 28, 2014 That won't work. Well, it will work, but of course if you can figure it out mathematically then certainly do that. Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/
Recommended Posts
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.