Download

Trouble spawning objects at a random location along an axis.

I’m trying to spawn projectiles along the Y axis of an arrow that’s in the player component. However, when randomly generating where it spawns, it will then only spawn along the Y axis.

I’ve got a GIF of what’s happening, and the code that it’s running from. If anyone knows how to fix this, that’d be a great help.

I’m not quite sure what the problem is, are you saying that when the character turns, the axis doesn’t turn with him?

That will be because you need to connect the arrow to the capsule.

Hi, thanks for your reply. The arrow component is already apart of the capsule, but I think I can explain it better. When the player rotates the projectiles still spawn along the world Y-axis, whereas I want it to spawn along the arrows Y-axis.

I made these simple images to help put across what I mean by the projectiles spawning along the world Y-Axis. I want it to rotate with the player and spawn along the arrow’s axis instead.

Key:
Yellow = Projectiles
Black = Player
Blue = Arrow Component
Red = X-Axis
Green = Y-Axis

You can spawn them at right angles to the arrow like this:

ezgif.com-optimize(1).gif

It’s the vector stuff I mean, obviously you still keep your spawn node etc…

Thanks a lot this helped a bunch, got really confused when trying to make it and now I can get on with it. Thanks again.