Simulate a 2d bullet moving

I’m having two problems creating a 2D bullet blueprint.

When the bullet blueprint spawns it gets the travel direction from itself to the target.

The problem I’m having is that the bullet travels instantly to the target, as well it stops at the target instead of going past it and off screen.

MoveToTravelDirection is called on EventTick.

I think your problem is that you’re using the SetActorLocation node. As you can see from the API, that node essentially acts as an instantaneous teleport.

API link: AActor::SetActorLocation | Unreal Engine Documentation

What you could do instead is to add a ProjectileMovementComponent to your blueprint that is initially set to 0, that, when fired gets an additional velocity boost in the direction you want it to go. You can do this by using the SetVelocityInLocalSpace node.

A quick search turned up someone solving a similar problem, take a look here if my directions weren’t enough:

Here’s one of the images posted to that question that might make this idea a bit more clear:


Thanks for your information but I’m actually trying to avoid using physics. There is a simple way to move an object along a specified path and I’ve done it before but for some reason I can’t remember how.

You could create a timeline moving linearly from 0 to the results of your multiplication node (which is the final location you want to reach) and set the actor’s location to the value the timeline is currently at.

This has the added benefit of allowing you to determine how fast your projectile moves, and altering the curve to not be linear would allow the use of acceleration too, without using physics.

Let me know if this works, cheers!

That would work if I wanted the bullet to stop once at destination. I apologize as I forgot to mention I wanted the bullet to travel for a specified time in a single direction. I did end up making something which resolved the problem though.

Thank you again for the suggestions.