FVector::ForwardVector points to Worlds Forward Vector?

Somehow, if i implement it as shown, my projectiles all fire into a direction, which seem to be worlds local forward vector.
I cannot achieve my shooting with this.
I saw before, that i had to put into the Spawning a rotation too, so my compiler wouldn’t bother around which looks like this now:

	// Spawn a projectile at the barrels projectile socket location with that rotation
	AProjectile* Projectile = GetWorld()->SpawnActor<AProjectile>(
		ProjectileBlueprint,
		Barrel->GetSocketLocation(FName("ProjectileSocket")),
		Barrel->GetSocketLocation(FName("ProjectileSocket")).Rotation()
	);

Debugging this looks quite okay.

But as i tell in the Projectiles Launch method, i have to do something other.

I tried this for now:

	if (!GetOwner())
	{
		auto time = GetWorld()->GetTimeSeconds();
		UE_LOG(LogTemp, Warning, TEXT("%f: Projectile Owner is null" ), time)// %s"), time (Get->GetName().ToString()))
		return;
	}
	ProjectileMovementComponent->SetVelocityInLocalSpace(GetOwner()->GetActorForwardVector().GetSafeNormal() * LaunchSpeed);

But as it look, my Owner is null, and i don’t know now how to move on with this !

I see the error here:
GetSocketLocationRotation is 0,0,0 all the time, and does not represent the barrels rotation, so i have to get it somehow similar from the barrel and everything should be fine…

It’s just: I cannot use

Barrel-&gt;GetSocketLocation(FName("ProjectileSocket"))

There

It’s GetSocketRotation … Idiot me !
Somehow this was tricky to see …

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms