An easy and effective way to shoot a projectile

I would like to shoot a projectile (arrow) in an arc from and to a static position in 3D. I tried using the formulae located on the english wiki under the keywords “projectile motion” to calculate the path of the projectile, but I have problems understanding how to get it to work the right way (how to “turn” the arrow towars the target for instance).
I would greatly appreciate if I could learn of better ways to calculate the projectile motion.
I don’t really want to create the arrow as a physical body, because I am worried about a performance drop when many arrows are midflight at the same time.

there was a similar thread to this. I think the unanimous result, was to just orient the arrow facing the velocity direction. How it moves is up to you

I’m pretty sure this is the thread wezrule’s talking about:
http://hub.jmonkeyengine.org/forum/topic/arrow-physics/

That thread was using actual physics and stuff. It sounds like OP just wants to make the arrow travel down a parabolic arc without doing actual physics. Moving a 2D parabola (or equation of motion or whatever) into 3D is pretty simple (project X along X/Z) but I didn’t have time to teach basic math so I didn’t respond.

Maybe someone else is willing to help with that.

As for turning the arrow along the arc, if you have a velocity vector (which you would need to have), align the model this. It is a direction.

Indeed I was looking for a solution which doesn’t use physics. I was hoping to hear a few alternatives to the method I mentioned(something a little simplified) or arguments as to why not just use physics ( I believe, they would cause a performance drop when 100 arrows were shot at the same time - even though they are not big nor complex models).
Thanks for the information so far though! Didn’t expect such an alive community.

Here’s how I would approach the problem. Add an abstract control to the node or geometry which represents the arrow. Store the arrow’s velocity vector in the control. Each time the control is updated, subtract tpf * 9.8 meters/second from the arrow’s y velocity, change the arrow’s rotation based on the new velocity using Quaternion.lookAt(), and add tpf * velocity to the arrow’s location.

In my experience, polygon count – not physics – is the factor which limits jME3 performance. Your mileage may vary – as may your CPU and graphics adapter.

@sgold said: Here's how I would approach the problem. Add an abstract control to the node or geometry which represents the arrow. Store the arrow's velocity vector in the control. Each time the control is updated, subtract tpf * 9.8 meters/second from the arrow's y velocity, change the arrow's rotation based on the new velocity using Quaternion.lookAt(), and add tpf * velocity to the arrow's location.

I wrote a system like this, additionally it uses raycasting to recognize collisions.
It’s based on zay-es, so maybe it’s a bit different to what you would build, but the overall concept should be reusable.
Google Code Archive - Long-term storage for Google Code Project Hosting.

@sgold said: In my experience, polygon count -- not physics -- is the factor which limits jME3 performance. Your mileage may vary -- as may your CPU and graphics adapter.
This is my experience, too. I played around with my ArrowSystem, and it made no point, how many arrows were flying around. But after some time, with arrows sticking everywhere, the system got slower. After I added a timeout for the arrows, it was fine again and I could fire as many arrows as I liked to.
2 Likes
@sgold said: In my experience, polygon count -- not physics -- is the factor which limits jME3 performance. Your mileage may vary -- as may your CPU and graphics adapter.

Probably more object count than raw poly count.

1 Like