Help with collisions for VR drum game

Hi Unreal community,

I’m working on a drum VR game for a school project and I’m having problems with the collisions between the drum stick and the drum.
The collisions work when the stick is dropped on the drum, but when the stick is picked up by the player and the player tries to hit the drum, the collisions don’t work.
I was wondering if anyone knows how to fix the collisions and possibly make a sound play when the drum is hit by the stick.

Thanks

Hi there!

I have recently developed a similar concept of virtual musical instrument. Instead of using collisions, I used overlap events to trigger the sound when the stick hits the drum.

Set OverlapAllDynamic on both the drums and the sticks. Make sure Generate Overal Event is ticked. Within the drums Blueprint, track the Event OnBeginOverlap and cast the Other Actor to the stick blueprint to make sure the drum has been hit by the stick. At this point you can play the drum sound specific to the drum that has been hit (you can have many different drums). At this point you can also play an haptic feedback on the controllers to simulate the hit, but my tests have shown that if someone plays fast enough that would significantly lag behind. A potential solution would be to “predict” when the stick is going to hit the drum and play the haptic feedback a bit in advance (do a line trace in the direction of motion, check speed/distance, estimate hit time, play the haptic feedback)

A disadvantage of this method is that, in this way, the stick is able to go through the drum. On the other hand, the stick keeps following the position of the touch controller instead of being “left behind” on the surface of the drum, which is a much more intuitive behavior to the player. It turns out people can quickly learn this behavior and halt their downward hit motion as soon as the virtual stick hit the drum and the sound is produced. After a while it becomes intuitive to them.

Hope this helps. Feel free to post your progresses here if you need further help. Good luck with your school project!

Cheers,
Marco.

Thank you so much for the reply. I will probably try to implement your method tomorrow for the timpani in my game. I kind of lied in my original post saying it was a drum game (I wanted to generalize the topic to increase my chances of getting an answer) and I’m sorry for it. In reality it is more of a general percussion simulator with timpani, cowbells, a triangle and two crash cymbals. Your method will surely work for the timpani, but my problem still stands with the crash cymbals that would need to be hit against each other. The cowbell and triangle can easily use the same method as the timpani if I attach them to some sort of stand, but the cymbals really are my main problem.

If you have any ideas about this please let me know and thanks again for the help.

Gabriel

Hi Gabriel,
I thought a bit further about your scenarios and here are some more considerations.

At first using hard hits, also for the cymbals, may sound like a good idea, but in practice it may have more drawbacks than advantages.

Say that you attach the virtual cymbal meshes to the touch controllers. When the user wants to play them, she is going to bring the two controllers quickly one toward the other in the typical play-the-cymbals motion. In VR, the only visual indication to the user of where the controllers are in real space are the cymbal meshes attached to them.

If, when the cymbals get into touch, you detach the cymbal meshes and hold them still at the collision position, it is very likely that the user will loose the reference to where the controllers are, will keep moving them one toward the other resulting eventually in a real-life collision between them. In this way they could even hurt themselves by smashing the controllers hardly one into the other. You don’t want that.

To prevent that from occurring, you have to keep providing some visual feedback on where the controllers are after the hit and, at the same time, hold the cymbals at the collision position. You can use some phantom/semi-transparent copies of the cymbals for that, or another visual cue. Then, when the controllers come back because the user has inverted the movement, you have to re-attach the cymbals to the controllers so that the playing cycle can repeat.

I find that using overlaps, while not being entirely realistic, is much simpler to handle and provides a better user experience.

Anyway, since we are all still learning about what works and what doesn’t in VR, I would say try both options with a number of test users and see which one they like best.

Cheers,
Marco.

Hi Marco,
I made some good progress since your last message. I’ve added correct collisions as well as sound on hit and overlap.

I just wanted to describe my project quickly and better so you can get an idea of exactly what I’m making.

Since we couldn’t get one of our premade environments to work, we decided to just create a simple platform and environment using the free Infinity Blade assets in the marketplace. I created my own meshes of a triangle, cowbell, crash cymbal, stick and timpani. I used the default VR motion controlled pawn that has visible hands and can teleport. After I placed the instruments on the platform and created, I added collisions to all the objects and copied the blueprint that makes things grabbable from the motion control VR demo map and added it to every instrument other than the timpani. The teleportation area needs to be fixed, but
I’m considering changing the platform anyways later if I have time.

I started trying to add sound on hit/overlap and it works. I tested it with one of the sticks and one of the timpani. There is just one problem, when I let the stick fall/rest on the timpani the sound is played a million times and ends up killing our ears and severely lagging the game. If you know anything about how to fix this it would be incredibly appreciated. The stick also still phases through the timpani, but as you said earlier it’s manageable once the player gets used to it.

Other than that, only cosmetic and environmental details and a button to control what music is played in the background are left, but I’ve already figured out how to implement them.
Bellow are some screenshots of my game and some of the blueprints to make things a bit clearer.

Thank you so much for your help.

Sincerely
Gabriel

Grab blueprint


Sound blueprint
Picture: http://imgur.com/a/0ecdw