Download

How to detect which kind of Pawn is being used?

Let me describe my problem first, I set FirstPersonCharacter as my initial GamePawn when I press [Play] in unreal editor, then I have a car in my scene, my FirstPersonCharacter can run near the car, and after press [E], Possess in blueprint node will set GamePawn to my carVehicle, so I start use keyboard drive my car in the game world. But I have some object in my world which will interact with my FirstPersonCharacter, for example, I have a crystal object, when character get into it, it will popup a widget in the viewport which allow me to change material of crystal through the widget, when I get away from the crystal, the widget will disappear. But I do not want this happen when I driving my car near the crystal, so my idea is, after OnComponentBeginOverlap in Crystal Blueprint, there is a [DETECT-CURRENT-PAWN-TYPE] step, then if my current pawn is not assoiate with Car? (I do not how to say) , then creat the widget, if my current pawn is FirstPersonCharacter, do not creat the widget.

So my question is, how to achieve this? And how to center mouse cursor and freeze game camera movement when widget created, thanks a lot :slight_smile:

Check the class of the pawn

Can you show me node graph how to achieve it? I try Branch[Get player pawn [=] FirstPersonCharacter] but I failed :frowning:

On beging overlap there should be a port for ‘Other Actor’ or ‘Other’ which is a reference to the object that is overlapping your crystal object. You can drag off this reference and create a ‘Cast To’ node which checks if this Actor or Component is equal to what you want it to be. So you’d create a cast to for your Car or Character and if the condition is met then do this and if not do that instead. Cast To is like an if function, is this object equal to this class?

There is also a Set Game Paused node which pauses your game for you. In terms of mouse location, check this out How could I Set mouse position via Blueprint? - UE4 AnswerHub

Here’s a good example of casting used for Overlap function! https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/CastNodes/index.html

Thanks a lot, it definitly helps a lot, my question alreadu solved :slight_smile: