Tuesday, November 22, 2016

2D week12

2D week12

This week for 2d class. We are working on adding more  details to our environment.



I made a particle system for smoke coming out from Tinman's house.
  It's a very simple set up.
I used flip book texture of smoke from starter content to make my particle material.




I also made some adjustment on leave texture. I change the blend mode to translucent instead mask since GPU particle's collision module do not work with opaque material.

I also increase the life time range on leaves particles and add collision module so that leave will hit the ground and stay for a while then died

One of the feed back from last week is that we want our falling apple pickable. I discard the apple particles since it can not reference class blueprint as its mesh data.
Kay made a trigger box for the tree animation. I call the trigger box on actor beginoverlap function in level blueprint and pipe it to a spawn actor function that would trigger physic on apple blueprint class which is pick-able.

Another task for me this week is making some flying butterflies in the scene. I found a butterfly with AI behavior example in UE4 example content, so I decide to recreate a similar AI behavior butterfly blueprint for our level.

The major components in this blue print is 2 plane meshes as butterfly's wings and a particle trail and several arrow component as my position and target indicators.
The texture is created by Leah. I made a very simple material for wings.
In my construction script, I assigned material to my mesh and the initial location for my attractor.

    First thing I did is setting up butterfly animation through blueprint with set Relative rotation function, set relative location function and timeline. I have left wing rotate 80 degree on x, right wing rotate 80 degree on, and the butterfly body doing a slightly move up and down. My timeline is set to loop and my length of animation is 0.5 second so that my butterfly flip twice every second.
   
Now, the butterfly is flipping its wing, we want it to fly forward with time. I set up a float variable data second which gets its value from event tick and a boolean variable Fly forward with true as my default. To make it actually fly foward, I have the forward speed (position x) set to 100 and multiply to my delta second and feed into my add localoffset funcion that drive my butterfly foward with my delta time variable.  
I had my target attractor initial in my construction script which is an interactive component for user that can be place anywhere in the level. To make my butterfly always facing the target attractor so it can fly toward it. I set up a set world rotation function for my butterfly base. The function I used to feed the new rotation is Find Look at Rotation (Find Look at Rotation take my butterfly base to point at my fight target).

I used a lineTraceForObject function to do a collision trace along the path which between butterfly and target point. When it encounters a static mesh obstacle it give out True value.

Then I link a Branch statement after the line Trace function. When it is true( means butterfly hit something), it plays my butterfly landing animation for once.
After landing animation is finished, 3 things happened.
1. the butterfly flying animation is stopped.
2.resting animation is played
3. deactivate my butterfly trail particles
,


After some delay, butterfly got reactivated. This is the part I haven't really figure out tho.


1 comment:

  1. I really enjoyed the butter fly effect. Try to get the leaves and the smoke to match your style you have for your world!

    ReplyDelete