hi all,
I have somme probleme with GetActorLocation() and SetActorLocation() function.
I want to make a rester system in my game.
here is my code :
BallBall.h :
protected :
/* teleport to the last save point */
void GoSavePointLocation();
/* save the reset location */
FVector bSavePointLocation;
BallBall.cpp :
/* constructor */
ABallBall::ABallBall(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
// do stuff
bSavePointLocation = this->GetActorLocation(); // save reset location
}
void ABallBall::GoSavePointLocation()
{
this->SetActorLocation(bSavePointLocation , true );
}
void ABallBall::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
// do stuff
InputComponent->BindAction("Reset", IE_Pressed, this, &ABallBall::GoSavePointLocation);
}
If i presse Reset key this dosent work if the ball is in the floor ( wtf ) but " work " if the ball is in the air. I say " work " cuz the ball dont teleport in the right location saved by constructor .
Thanks
Edit : i understand now, use
bSavePointLocation = this->GetActorLocation();
in constructor is wrong . i think my bSavePointLocation will be the PlayerStart Location but no its all time (0,0,0). H
How i can get PlayerStart location ?