How to replace the cursor with a 3d model?

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