![]() ![]() Another is what we will use it for, which is to correctly display the sequence of particles in the trajectory the player is "shooting". One common use for this is the player.getEyeLocation().getDirection() function, which describes which direction in 3D space the player is looking. One very helpful Vector for this in Minecraft is Direction.Ī Direction Vector indicates which direction in 3D space an object is facing or moving. Repeat this and you have a line of particles. To display the particles one after another, we can simply add a Vector offset to the particle's current location and then display another particle at the new location. Make it go fast enough with short enough distances between particles and it looks like a laser beam. So how do we use this information? A particle beam in Minecraft is just a series of particles displayed in a direction over a period of time. An offset of 4,4,4 is moving twice as fast as an offset of 2,2,2, but it's moving in the exact same direction. ![]() Its "speed" would be the length of the Vector. That means the "direction" of whatever it describes is going up and away at an angle from the center 0,0,0 location. The blue line is a Vector with an offset of 2,2,2 from the origin 0,0,0. Click the link to view it animated so it's easier to get the idea. Here's a picture of a Vector in 3D space. The longer the Vector, the faster the "speed".A Vector is just a point in 3D space, offset from 0,0,0.A Vector is used to indicate both direction and speed (AKA Velocity).A Location is a single POINT IN 3D SPACE, but Minecraft adds the world, yaw (left/right angle) and pitch (up/down angle) to the Location class.Minecraft uses x,y,z coordinates, where y is elevation instead of the standard z.Don't skip this, because you'll end up confused and frustrated if you do. Take the time to learn this, as you will be using the concepts frequently in Minecraft. This tutorial will cover the basics, and then get right to more advanced particle beams.įirst of all, it's VERY CRUCIAL to understand Location and Vectors. Personally I learn better and faster from taking a working example and then dissecting it to see exactly how it works, so I LOVE IT when people spoon feed examples. Hopefully this will help someone cut through all the chaff, since lots has changed since most of the good tutorials were written. PART 1 - A Basic Particle Beam Straight LineĪfter digging around here and on Bukkit forums for hours, testing, tweaking, researching and pulling hair out, I finally have a good grasp of this topic. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |