Download

ue4 VR how to disable dropping the pickup item when grabbing on it

Hello everyone, just a newbie on this engine.

I’m using the given unreal engine vr blueprints to try things out.

I’m currently trying to do something like this :

Grab an apple, and when apple is hold near to me, eat the apple

I’ve almost implemented everything, but when I let go of the apple, it still gets eaten

Maybe I needed to use a for loop, and when a condition is wrong, the loop fails and stuff, but I’m not sure how to do it

Any ideas?

Oh and I implemented the pickupactor interface and copied the exact code to pick the apple up

Hi man,

What i can see in your blueprint is:

When something overlap “apple” — check if is motioncontroller- mouth ---- if yes: eat the item (change mesh) —wait 1 sec, … change mesh again… — ( outiside graph)

“when i let go the apple”
What happen? maybe your collision are too big, and you still collide with the mouth even if you dont have it in hand ?

You should be able to eat the apple only if you have it in your hand? (otherwise you could eat apples just going near them with mouth)
You should be able to do add a check or a variable,
When you pick up an apple, you can make her selected or active or eatable, with a variable.
Than if is in hand, the apple check the mouth and get eaten.

Another thing,
you should add a variable that block the Begin overlap to be casted again and again,
right now you can move quicly the apple near mouth, to trigger multiple time the Begin-overlap,
before and after the delay of 1 sec, messing around with your meshes and timing.

you could add a simple bool, named “ActionAtWork” that just after starting “eating item” get set to 1.
And just before that, check if the variable is 0, if yes, continue, otherwise do nothing.
if you trigger the eating only 1 time until you reset the ActionAtWork.
Preventing the mess

Thanks it did help