0
\$\begingroup\$

For context i'm using Java and Minecraft Forge, however the concept should be fairly standard. To spawn particles you use this function...

world.spawnParticle("largesmoke", posX, posY, posZ, velocityX,  velocityY, velocityZ);

This works fine, however I am trying to give the particle a velocity which will rotate it around a point (the player) and give the effect of a tornado (obviously more will have to be spawned, I also have the random position setup to each particle).

In short, I would like to find a way to give it a tornado like velocity.

Thanks

\$\endgroup\$
1
  • \$\begingroup\$ Though mod creation is technically not off topic, this site generally doesn't generate the best answers for modding I recommend that you read the tour page to get better answers in the future. As for actually creating the effect, it would help if you would tell use what you have tried. \$\endgroup\$
    – Lysol
    Feb 9, 2014 at 0:20

2 Answers 2

2
\$\begingroup\$

It is not possible to give anything a velocity such that it will rotate around a point, with a constant velocity you can only make an object follow a straight line.

If it is possible to modify the velocity of your particles after they have been created then you can create some with a velocity which is tangent to a circle around your player and then accelerate them toward the player with |a| = |v|^2 / r to achieve uniform circular motion.

If you can not modify your particles velocity after creating them but you can make them disappear fairly soon after they are created, then you could make lots as above surrounding your player and possibly make it seem that they are rotating even though they are not, creating new particles after the old ones have disappeared. If you have access to the position and time that they will disappear at then you could also consider creating new particles with a modified velocity at the position that the previous particles disappeared at.

Make sure that all of your particles rotate around the player in the same direction to make it look more like a tornado. One way to do this is to just use the vector from the player to the particle's initial position rotated 90 degrees around the up axis as the particles initial velocity, scaling if you need to.

\$\endgroup\$
0
\$\begingroup\$

I'm not familiar with Minecraft Forge, but Every 3D game engine particle system should have a set of objects or helpers that interact with your particle systems affecting them by forces. For example gravity can be a linear force field given a vector or radial force field given a position.

You need to link your particle system with a force field around a line or cylinder while the force should point inside to the cylinder; Then spawm particles around the center (1.5 character width aprox.) perpendicular to the force field.

If your game engine doesn't support those type of force field try following trick with similar effect:

Spawn a bunch of particle system around a circle on the base or your character then rotate these positions where the particles are spawn (posX, posY, posZ). The effect is like a fountain, with spirals.

Last option, because I think this will slow down performance, if you have access to modify particles velocity in real time implement the solution given by @Alex:Taking a normalized vector from particle position to character position vertical axis, multiply it by acceleration, then add it to current particle velocity vector.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .