How it is possible to cast from Actor object to patrol point type?


In 6:40 instructor cast from Actor object to patrol point type (location in space) how this possible ?


1 Like

Go the lecture “Patrol Point” and at 2:40, there is your answer. The Patrol Point is not a point in space - FVector/Vector type object but is actually a Blueprint that inherits from the Actor. This means that it can be cast from Actor to the PatrolPoint.

Please don’t flag posts in future to gain attention. A simple reply to your original message would have bumped the post (you can do this twice only mind you)


Also, please allow up to 24-48 hours for a response as the TAs may not be able to get to you right away.

As to what I believe is the heart of your question. We can cast from an object type of Actor to Patrol Point because Patrol Point is a child of the actor class. In fact, all objects that can be placed or spawned in a level are children of the Actor class.

Child classes have the benefit of inheriting all of the properties and functions and their parent classes while allowing us to make changes or add to that functionality.

When we store them as an object reference, the child class can pretend it’s actually its parent for more flexibility. As parent classes may have multiple children. However, if we want to access the properties or functions of that child (or in this case, confirm which child class it actually is) then we have to cast to that child class.

1 Like

Thanks wonderful explaining

Privacy & Terms