segunda-feira, 20 de junho de 2016

BP Compendium 2: Pawn

Pawn


The "Pawn" class represents the actors that can be controlled by players or by artificial intelligence. For each object of the "Pawn" class there is an object of the "Controller" class. The "Pawn" class is the physical body and the "Controller" class is the brain.

Create a Blueprint based on "Pawn" class and click the "Class Defaults" button to display the attributes that have been added in the "Pawn" class.


The "Pawn" class can use the rotation values of the "Controller" that is associated with it. Other attributes indicate how the "Pawn" is owned by a "Controller".

For a "Controller" to control an "Pawn" object it must possess this "Pawn". A "Controller" can change the "Pawn" being possessed during the execution of the game. For example, in a game that the player controls a person who can get into a car, there is the "Pawn" representing the person and there is the "Pawn" that represents the car. When the player get into the car, the "Controller" will possess the car "Pawn" and the movement commands will be answered by the car.

The image below is from a Level Blueprint showing the use of the "Possess" function. This function belongs to the "Controller" class.  It requires a "Controller" and a "Pawn" to be possessed. In this example it is being used the "Player Controller" of the first player who will possess a "Pawn" called "BP_Car" that is on the level.




Table of Contents