Golden rule to learn early on. Always make new nodes ( and variables ) by pulling a pin that already exists. So here, drag from ‘out hit’ and you
can see break hit…
I’ve added some magical ‘bobbing’ to it
Golden rule to learn early on. Always make new nodes ( and variables ) by pulling a pin that already exists. So here, drag from ‘out hit’ and you
can see break hit…
I’ve added some magical ‘bobbing’ to it
I’m going to try and explain it in one go, sorry if it’s a bit much. I will come back and help if need be, but not till tomorrow
I made a stick blueprint
Notice: the stick has it’s X axis pointing the same way as the X axis of the BP. Also notice that variables, bottom left.
The stick also needs to ready for input
The ‘actor list’ variable in the stick is an array of actor references. Notice the ‘eye’ is on for it. That means we can set that array in the level.
When we put 3 shapes in the level, and our stick, we can set the array:
On begin play in the stick, we have
Only the location is important, the timeline is just the bobbing…
The code that handles ‘O’
It takes the next actor from the array, and increments the index. If the index is off the end, rewind.
The main business is here
What it does is
Check the current actor is set ( it’s not to begin with )
Because we want to be above and back a bit from the actor, we take its location and add or subtract a bit. Once you get going, a bit of vector math will do this better, but for now, you can just tinker with sum to get the right position. ( It depends where you are in the world and which way you’re looking, at the moment ).
Then we ‘interp’ our location and rotation to move over and point to the object. Interp is what gives this nice smooth change. We calculated the location in (2), but the rotation uses ‘look at’, which why it was important to get the stick X axis pointing the right way.
Anyway, have a go, tell me how it goes
Hi, thanks for the advice; however, the option I am supposed to put does not appear, how did you do it?
OK:
You have a MULTI line trace there. That returns an array. If you had a ‘line trace by channel’, then you could break the hit, but…
I didn’t use line trace in my example, so you can leave that out
To get a list ( array of a variable type ), just change it here
then you can put more than one in.
Code problems: Notice on that play node, the pin says ‘sequence player’, not timeline.
Remember my first bit of advice ( about 15 pages back )? Always make your nodes by dragging. So, drag from the timeline variable, and search for ‘set play rate’
‘New track 0’: you can just change the name in the timeline, doesn’t really matter.
This should go here
( timeline controls alpha ).
For this:
I’m assuming your ‘target’ is the stick, which is a mesh in your blueprint? In that case ( again ), just drag from ‘target’ and search for ‘relative location’. Like I say, this part only controls the bobbing of the stick.
All your other problems will go away, once you make that array
Your corrections are very good, ClockworkOcean Sensei , now I understand and I have been able to correct almost everything; I will never forget your phrase “Always make your nodes by dragging”. I hope more people can find this post and learn from these teachings you have given me.
As for the “set play rate” I am not able to get the right node, I don’t know what to do:
Then there is the issue of the “Timeline” numbers but it may not matter.
All this is in the “blueprint” of the “Actor stick” isn’t it? Or is there something that should be in the “Blueprint of the level”. From what I’ve learned, where the nodes are is irrelevant, right?
I can’t get the stick actor to notice the other actors (cube, sphere…) but I must be very close to get it. Maybe if I fix these two bugs it will work.
By the way, I have the impression that your camera is fixed, but mine is a normal one and it moves, does this influence?
Best regards and thanks again.
Ok, not dragging from an execute pin
Dragging from something with context, in this case, the timeline reference
Have you put an instance of stick in the level, and assigned the actors?
PS: Have you enabled the BP for input?
And, yes, fixed camera, because that what you said you had ?
Doesn’t matter though.
Keep going, you’re close…
You can check the stick is getting input by putting a print node here
Any luck?
XD give me a little more time sensei, I’m going a little slow because there are a lot of things I still don’t understand. It turns out that by changing the “Variable Tipe” of the “ActorList” some things have gotten out of configuration and I’m fixing it.
Good! I made it! (sort of).
For some reason the stick goes half a meter away from where the sphere actor is, but maybe it’s because I have the camera in the wrong place?
I don’t know what a BP enable is for input; so that may be it.
As for the fixed camera, I thought I had managed to fix it, but apparently it is only fixed when the menu appears (which now with this method I will no longer use).
If I fix that, the only thing I’ll have to do now is to make it so that when the stick points to the sphere it changes, for example, the screen resolution. Yes, I will be able to make a “Metro” type menu, but that’s up to me, I don’t want to bother you anymore.
Thank you very much for your patience Sensei, I will bookmark your post as a solution, I hope others will learn from this tutorial too.
The stick is just going to the wrong location. Can you show me what you have now for the blueprint in the stick?
Sorry it took me so long to answer, I was making lunch, here are all the nodes:
It all looks ok, apart from this
Notice it’s bright green? That means you converted to float, it shouldn’t matter but…
So just remove the node and drag off ( yes! ) from the ‘actor index’ and search for ++
Also, you haven’t added on the location in the vector sum here
but that’s ok for now. All it means, is the stick will point directly at the center of the object.
Try printing out the stick location every time you calculate it, here
to make sure it’s 0,0,0 the whole time.
That’s it! Now it’s perfect! Thank you very much. Here I leave the gif so that you can check that it is true (the stick points first to the sphere below the ground (indicating the path to follow) and then to the one above it (indicating an object to interact with).
ey!