So I have a situation where I put hundreds of objects(cubes) into the scene. I randomly drop the player from the sky and it lands on one of those cubes. My task is:
1.Find the reference of an object I have landed on.
2.Find the reference of objects(cubes) around me.
But I dont know what is the function to get reference of an object, can aybody help me? Or maybe there is better approach to this tasks?
You can use the various overlap checks to get all actors in a range. Actors overlap check
You can use an actor iterator and then check the distances on. More on that here
lastly, not sure if this applies to you, if you use the CharacterMovement, it stores the floor you are walking on as FHitResult, which also has a reference to the actor you are walking on.
You could also expose a field using
UPROPERTY(EditAnywhere)
class AActor* SelectedActor;
and just manually set the reference this way, but it is probably not applicable for you.