How to replace the cursor with a 3d model?

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

stickv4

1 Like

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 :slight_smile:

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

  1. Check the current actor is set ( it’s not to begin with )

  2. 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 ).

  3. 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 :slight_smile:

2 Likes

Hi, thanks for the advice; however, the option I am supposed to put does not appear, how did you do it?


I think you are amazing, you have done something magnificent and you make it look simple. I have followed the steps, but there are things that do not appear the same, like this symbol here:

I have not been able to make a list of actors either, it only lets me put no, why?
B
Finally I have had problems with some parts of the code:
Red: for some reason it won’t let me connect these nodes like you.
Yellow: The subtitles of these nodes are not like yours
Green: how are these numbers added?
Blue: for some reason the program adds these nodes that transforms the color of the nodes so that they can be connected, why doesn’t it happen to you?

I’m sorry I’m taking more time than you have already spent, I’m sorry I don’t have more knowledge to follow your steps, but I have to say that I’m learning a lot and I hope I’m not being a nuisance.
Best regards and thanks again.

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 :wink:

To get a list ( array of a variable type ), just change it here

image

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’ :slight_smile:

‘New track 0’: you can just change the name in the timeline, doesn’t really matter.

This should go here

image

( timeline controls alpha ).

For this:

image

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 :wink:

2 Likes

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:
Untitled-Project

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 :slight_smile:

Dragging from something with context, in this case, the timeline reference

image

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… :slight_smile:

You can check the stick is getting input by putting a print node here

image

1 Like

Any luck? :slight_smile:

2 Likes

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.

1 Like

Good! I made it! (sort of).
Untitled-Project

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?

1 Like

Sorry it took me so long to answer, I was making lunch, here are all the nodes:


I think it is correct, the stick or wand does point towards the sphere, but it does so from a different place.

It all looks ok, apart from this

image

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

image

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

image

to make sure it’s 0,0,0 the whole time.

2 Likes

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).
Untitled-Project

ey! :smiley:

2 Likes