So I’m working in a first person template, and I have a box raytrace, tracing for pawns. So far if it hits one it will just show it’s name, but I want to be able to stun the pawn and prevent it from moving for 10 seconds.
Is there any way to access an individual scripts variables?
Yo, if you hit a Pawn or what ever you are tracing, you will get the “HitActor” in the HitResults. That thing is the thing you might have hit.
It’s of type Actor, because that’s the top most class that can be spawned in the Viewport.
To access the Variable and Functions of the actual class you hit, you need to CAST the “HitActor” to what ever class you hit.
NOTE: If you hit, for example, a Car and cast to a Human, the cast will fail. Casts only work if the Object you want to cast to a specific Class is
actually an object of that class or an object of a child class of it. (If this is unclear, try googling inheritance for C++).