The rest is above
DG Gage 1 min ago Newest
Here’s a very simple rundown on what casting is so you can understand the concept and start developing complex concepts with it:
When you create a blueprint, it’s like an unborn framework for any objects you create with it. You’ve created their look and behavior, but they’re still unborn.
When you place a blueprint in a level, or spawn it with another blueprint, you’re giving birth to a particular copy of that blueprint. This is called an instance. It’s alive and ready to go.
If you put BallBP into the level twice, you’ll have BallBP1 and BallBP2. They use the same structure, but are separate and individual entities. For simple actors like these, you can simply cast to them with a reference of their particular instance, with something like a levelBP reference, Get All Actors of class, Overlap results, etc.
Cast inputs are necessary because blueprints usually rely on something else to function.
Sometimes you even have a situation where you need to cast to component of a larger . An AnimBP, for example, is only created when a character is in the world that uses that AnimBP for its animations. When that character enters the world, it creates its own instance of that AnimBP to use; otherwise, all characters using it would always be doing the exact same thing.
So for casting to something like that:
Get Player Pawn > Cast to [playerBP] > Get Skeletal Mesh > Get Anim Instance > Cast to [animBP].
And then you have situations where you need to change the physics on an actor. Since physics exist per component of an actor, you have to cast to a particular component (usually the root). You would have to give it info on what component it is, and what actor instance it’s coming from. So that’d be something like:
[get actor instance] > Cast to Actor > Get Root Component > Cast to Primitive Component.
Summary…