Delete a pickup Actor (Blue Cube :-))

Sorry for my english. :slight_smile: I spawn with one Trigger many cubes in my level. I use the pickup code from the Blueprint from the VR template. (The blue cubes :-)) Everything works fine. I can pickup the cubes and put down again. (The different to the template is: at the beginnig, the level is empty. The cubes spawns with the trigger of the motion controller)

My question is: when I now pickup a random cube from my many spawned cubes in the level, how can I delete this special pickuped cube? (I would use the DestroyActor)

I would take, for example, the left Trigger, or the x Button, for destroying the pickuped cube. I can check this event in the MotionControllerPawn blueprint. But there, I do not know, which cube (Actor) the player have pickup. And in the Blueprint of the pickuped cube, I dont get the events from the MotionController.

Perhaps: can I read out in the MotionControllerPawn blueprint, which actor is attached to my hands?

Hope, my english was not to confusing.

You can set a variable on your Character called “CubeToDestroy”
Then, in the cube, when you pick it up you can cast to your Character and set this variable to be this cube in particular, and you just pin this variable to the destroy actor node (maybe coded in your character and called from the cube or from anywhere you want).

Great, that was it! Thank you very much. No I must figure out, how to open the hand, after delete the Cube, and finish the “pick up” moment for the programm. But this is for another day. :slight_smile:

Edit: I put the routine (“is there the wish to delete this pickup cube”) in the DropDown Part of the Blue-Cube-Code. So I do not need the event Tick and it feels more like “Drop it in the trashcan” :slight_smile:

Everthing, for this moment, is solved. Thanks a lot!

Cast-to, oh, I “love” it, (I am missing global variables) BUT this sound like a good Idea. We in germany say “hatte ein Brett vor dem Kopf” (Meant: yesterday, I have a board in front of my head => could not see any solutions…)

I think, I must take the cast in a (slow) Tick-Event, because, not everytime, I pick up a cube, I want to delete them. Only, when I press a Button during I hold the Cube. The “cubeToDestroy”-variable would change during the time, I have it in my hand.

I try it and write a respone after it. Thank you very much.

I think you can add a delay to that Event (if it’s not on tick) to let the hand some time to recieve the “open” event from the cube before it destroys but I’m not really sure about that.

Good luck with your project!