Projectile Orientation

I am experimenting with a simple 2D sidescroller game in which the player can shoot arrows. I have made plenty of projectiles before, but for some reason I cannot figure this one out. I absolutely cannot figure out how to make the arrow projectile have the correct rotation when it is shot. It fires in the correct direction, but the arrow fires upright, with the tip pointing down, 90 degrees from the travel direction, instead of pointing forward with velocity.

I have tried:

  • Rotating the capsule collision and paper flipbook. This works if I have a scene component as root for my projectile, but I need the capsule collision to be root for collisions to work properly.
  • Setting the initial velocity on a different axis (arrow no longer shoots in correct direction)
  • Rotating the arrow 90 degrees, either in its own begin play or the transform on spawn. This has no effect.

Rotate the sprite image and re-import instead?

1 Like

This worked. I was trying to avoid doing that as I would have to re-extract the sprites, etc, but I suppose this is the best solution. Thanks. Still feel like there has to be a way.

EDIT: This did not actually work. See below.

Ah, it was the sprite :slight_smile:

Correction: This actually did not solve the problem. It only rotated the sprite out of the capsule collider. Re-orienting the sprite in the capsule collider returns the problem.

I just tried an experiment. I have a sprite, which looks pretty much NOTHING like an arrow:

But it’s kinda pointing to the right. Ignore the widget on the sprite, right is X ( I rotated it ).

Then I made a BP which just spawns a sprite, in it’s own transform:

Like this:

I get this:


Any ideas?

Yes, this works just fine for me too. The complication comes when I add a capsule collider and make it root (this is needed for projectile collision to work correctly, as I understand it). The capsule collider always wants to stand upright, never horizontal.

I have sort of circumvented the problem by using a sphere collider on the head of the arrow, instead of a capsule on the entire arrow. Its the arrow head that does the damage anyway. With the sphere collider, I can now simply set pivot on the arrowhead and rotate the sprite, a luxury I didn’t have with the capsule.

Ah, with you ( just tried it ).

I suppose it’s because the root component can’t have any rotation.

I managed to get it lying down even though it was the root, but then it still rights itself :-/

I see this exact issue has cropped up quite a few times.

Have you tried setting the rotation of the sprite in the construction script?

Also, there is a variable on the ProjectileMovement component called RotationFollowsVelocity; have you tried that?

That’s not true. Capsules can have whatever orientation you want.
However, the root component cannot be rotated differently from the actor itself.
Maybe what you want to do is to either rotate the actor, or make a “Scene” root component, and add the sprite and the capsule as children of that, orienting them as appropriate?