Can't get projectiles to move in -X axis

Architekt
Tue, 27 Jan 2015 04:08:03 +0000
World Creation

I must be doing something really dumb because I can make them move in the positive X axis but not negative. I modeled my code on the twin stick shooter. When I fire a projectile, they appear, but they don’t move. My UProjectileMovementComponent has its initial and max speeds set to -3000. When I go to spawn one I do:

FVector FireDirection(-1.0f, 0.0f, 0.0f);
const FRotator FireRotation = FireDirection.Rotation();
FVector SpawnLocation = GetActorLocation() + socket_transform.GetLocation();
World->SpawnActor(MyProjectileClass, &SpawnLocation, &FireRotation);

“socket_transform” is just the transform for the gun where the projectile fires from.

I thought perhaps the problem is setting a negative value for the speeds so I made them positive, thinking that the -1.0f for the X value of FireDirection would lead to it moving in the negative X axis direction but nope, it winds up just moving in the positive X axis.

3 posts - 1 participant