Hey Guys! I’m new to game c++. I’m getting acquainted with it by following along with different c++ examples.
What I’m gonna ask might sound pretty lame to some of the programmers, but i’m getting confused by the use of the const keyword.
For eg: right now I’m following along with the Fps C++ tutorial from wiki.
void AFPSProjectile::OnHit(AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{
if ( OtherActor && (OtherActor != this) && OtherComp )
{
OtherComp->AddImpulseAtLocation(ProjectileMovement->Velocity * 100.0f, Hit.ImpactPoint);
}
}
Please help me out. Above is an example from the project.
As far as I know. I think Hit is a reference to a constant vector. So, whatever location we achieved during the execution of the event we cannot change it. Is that right?
But we can change hit?
Please help. Thank you.