Andrew Booth 3D
  • Home
  • About me
  • Still Life Project
  • Twitter
  • Linkedin
  • Archived Blog

Setting up spawning functionality pt2.

8/16/2018

0 Comments

 
As shown in the previous post I created a 'for loop' which fired an custom event named spawning. As you can tell from the attached images; that event fires logic for spawning functionality. First I got the child class I created in 'Asset Handier' blueprint which an array containing the asset blueprints ready to be spawned.  The reason of using class type variables is because the 'spawn  actor' node only spawns actors from a  class. From this array of classes I used the 'length' node which returns the index value total of elements within that array as an integer (Fig1).
Picture
Fig1.
Picture
Fig2.
 This value I used the max input for a 'random integer in range' node which randomly picks a integer between a min and max values. I used this random return value to drive a 'get' node (which gets a single value of an array)  from my 'child class' array variable to the class input of the 'Spawn Actor' node (Fig2). This means the logic is random selecting an asset from the index of the array then spawn that into the world.
Picture
Fig3.
Picture
Fig4.
From the return value of the 'spawn actor' node; I used as a target for my interface event to pass through some data to that spawned actor and fire logic in that asset. I am using interface as a main way of blueprint communication so i can pass data between different blueprints. Using this methodology is most efficient since I'm using logic to set up certain requirements before the door into the next level. I also took the 'spawned amount', add one to that amount and then setting the 'spawned amount' so that the beginning of the loop knows how many assets spawned until the max amount of assets is spawned have been reached (fig3.)
The problem with this methodology is that the 'spawn actor' requires a transform input values so the game knows where to spawn the actor. To get around this I added a box collision component (Fig5) to act like a container where I can tell the game to spawn inside the collision.
Picture
Fig5.
The problem is that although you could get the world transform of the box collision but it wouldn't properly spawn inside the box to how I need it for the game as it will give the overall location not a pin point value to spawn and it wouldn't be random. In figure 6 shows how I got around this. I used a 'get component bonds' node which literally gets the origin (center  of the box) & box extent  values of the box. The math logic in figure 6 looks complex but the methodology once broken down is quite simple. The ideal is basically to break the vectors of the component bounds into float values; then working out the min & max values of both the X & Y axis between the origin and the box extent. Then feeding these min & max Axis' values into 'random float in range' nodes that is used to make a location vector from the X,Y and Z axis values. To simply put I used the 'random float in range' to randomly generate a random pin point location between origin & box extent of the collision box. To finish up I used a 'make transform' node; taking values from random generated rotations and scale values (fig 6) along with the location vector to make a Transform value which is used for the transform input of the 'Spawn Actor' node (Fig2.).
Picture
Fig6.
0 Comments

Setting up spawning functionality Pt1.

8/16/2018

0 Comments

 
Now that I have the room and the door imported with some logic scripted for the door animation; I next worked on the spawning functionality. I did this using a parent/ child hierarchy concept by creating a blueprint called "Asset Handier".

This blueprint which handles all my data from stored classes, the passing this through all data stored within it to all children and will be the overall parent to most of functionality  concerning spawning including the 3D assets data.

This blueprint also include a static mesh component that I leave blank that will be populated with mesh data later in child blueprint so that each child can have different assets with their on logic.

Picture
Picture
Picture
Picture
From  this I created a child blueprint from "Asset Handier" named as "Asset Spawner". This child blueprint will be where I handle the logic for the spawning of the asset being used for the game mechanics.
The logic for the child blueprint is broken into different sections. The first part is the referencing of variables stored in the parent even though the child blueprint inherent these variables It is makes it easier access to that data and more time efficient just getting the data from variables panel compared to searching for the data in the drop down menu.
 The second part is constructing the the loop index of the logic. As this is going to be the main logic of the game to spawn meshes I made an integer  variable for max amount of assets I want.
Picture
Another integer variable i used was 'spawned amount'; this is in the index of how many meshes was spawned. The concept is that, I use a 'For Loop' node that fires a custom event in the loop; then later in the logic adds one on to the spawned amount. Doing this turns the script into a checking loop logic where I test between the amount spawned and the spawned max. This means if the amount spawned is less the the spawn max the fire another loop until the spawned amount index equals the spawned max.
0 Comments

Animation for the door Asset

8/14/2018

0 Comments

 
Its been a month since last post, I have been busy with this project which I will update posts soon as possible. The next stage of this project was the animation of the Door so that I could build the functionality around the conditions to opening the door.

To do in Maya I didn't need to rig the door as its just a simple move of the asset across the space then adding those keys and editing the animation graph to improve the flow of the movement.

Picture
Picture
Picture
Picture
Once I completed the animation to my needs, I then exported the door asset along with the animation into Unreal Engine 4. With this I then created a new Animation Blueprint creating 2 new animation states and transitional condition. 

The two states as shown in the imagines are a start state basically the door closed state and a open door state that plays the animation when the transitional condition has been met.

The next step was to set up the functionality  around the door. To do this I created an interface event so in another blueprint when conditions met in another blueprint it would fire this interface event with potentially data across to the door asset if needed. I built the functionality so that when the event is fired it would do a sequence of tasks which is to get the animation instance of my door asset, then cast to the door animation blueprint then set the transitional condition to true in which plays the animation. From this I then wait 20th of a second with a delay and then destroy the collusion component; the reason I have a delay node just in case destroying the component would effect the animation so it acts like a some break between the two actions.
0 Comments

    Author

    Write something about yourself. No need to be fancy, just an overview.

    Archives

    August 2018
    July 2018

    Categories

    All

    RSS Feed

Powered by Create your own unique website with customizable templates.
  • Home
  • About me
  • Still Life Project
  • Twitter
  • Linkedin
  • Archived Blog