Using VR hands to make a counter go up adds two values to a single Integer

Hi, I’m making a game that requires the player to use both the hands in VR to hit away balls being shot at them and this makes an integer count how many times the player hits the balls, but the single variable I made increments for each hand and not singularly for both hands.

This us the output when I only use one hand. Counter works fine.

271531-singlehandcount.png

And this is the output when both hands are being used. As you see the single variable now shows two values, one for each hand

271532-bothhandscount.png

This is the collision and increment I implemented.

I am not sure if I am doing it wrong or if it is a bug.
Using Oculus.

Hi Hennie_AxioVR,

As you are using two controllers, you have two BP_MotionController objects in your scene that independently keep track of the number of ball they hit.

What you need is to create a counter inside another class. For instance, inside your Player Controller class or inside your Pawn class. Once you’ve done that, you can keep the same logics but instead of incrementing the counter “Hit counter” located inside you “BP_MotionController”, you increment the one you created inside your Player Controller class (or Pawn class that’s up to you).

Hope it helps!

Cheers.

Hi, will jump into doing that right now, you.

So I solved it not by casting to my pawn but instead created the variable inside my GameMode blueprint and casting to it, you.