I’m picking apart the Butterfly Blueprint in Content Examples(Blueprints) and I can’t figure this out. Is there a way to animate the attractor for the butterfly? I’m trying to make a group of objects(school of fish) and thinking this might work if I can animate the attractor on a spline or something. Any help would be great, I’ve posted a few times about creating a school of fish, which you think would be pretty straightforward, but no one has come forward with any help. Thanks!
I am making some assumptions:
- You want several fish to follow an object which can move.
- All the fishes follow the same object.
This is how I would try to do it:
- Create a fish blueprint and add a variable of type Actor(named Attractor). Make it public. In the Tick event, I will make sure the reference is valid and if it is, get it current location and make the fish move to that point.
- Place an Actor (any actor is fine) in the level and animate it (using timelines or by matinee)
- Place several instances of fish in the map. Edit the default property of ‘Attractor’ in all fish instances to the animated actor we created above.
If I made a wrong assumption, let me know
That is exactly want I want to do. Issue is I’m VERY green to Blueprints. I’ve been doing all the tutorials but it’s all just theory. Things I don’t understand in the above statement:
“make it public”
“in the Tick Event, make sure the reference is valid”
"make the fish move to that point - hows is this accomplished?
I also need the Attractor object to be moved…not manually, just be animated around an area. Like if you just want a school of fish swimming around an area. I’ve done this in Unity pretty easily with Boids, but kinds hitting a brick wall in UE4. Thanks so much for any help!
‘Make it public’ → Means you need to mark the variable as editable from outside. To do this, within the blueprint editor, find the variable in the list and click on the small ‘Eye’ icon to its right.
‘in the Tick Event, make sure the reference is valid’ → Since the variable ‘Attractor’ refers to an Actor in the map, we must first make sure that Actor indeed exists before doing anything with it. To do this we will use the macro ‘Is Valid’ and pass the variable as input.
‘make the fish move to that point’ → This is more involved. The basic idea is to update the position of the fish in each tick. You know the current location of the fish and where you needs to be. So using Lerp node or InterTo node, you can gradually update the fish’s location.
‘I also need the Attractor object to be moved’ → As I have said in the previous post, you can use Matinee sequence or a Timeline within the Actor itself to animate the attractor.
PS: If you find Blueprints very alien, I advice you to go through all the relevant you tube tutorials posted in Unreal Engine channel. That will give you everything you need to do this.
Thanks very much for the help. I’ll keep going through the tutorials and hopefully make some head way. I appreciate your time with this:)