PingPong

Hello Dear All,

I`m trying to create ping pong simulation. Only issue paddle acting weird, when i stand with the paddle ball bouncing great as usual (like wall) but i cant hit the ball (arm swing). In the attachment as you can see i used projectile movement in the ball for controlling velocity. For paddle i just used BP_PickupCube default blueprint from vr Template.

Test 1 : Without projectile movement, sphere collision checked Simulate Physics and Enable Gravity , Collision Presets BlockAll i can hit in proper way but ball is not bouncing !
Test 2: Without projectile movement, sphere collision checked Simulate Physics and Enable Gravity , Collision Presets BlockAll + Phys Material Override (assigned physical material) ball can bouncing proper way, hitting with the paddle is great but to fast cant control velocity of the ball and also cant reset location of the ball if the ball touch the ground !
Test 3: With projectile movement, sphere collision checked Simulate Physics and Enable Gravity , Collision Presets BlockAll, doesnt work because sphere collision takingover control projectile useless in that case.

Any idea ?

Cheers

You can check out the ping pong sample on this page.

Hey @fengkan, thanks for the advise but i already checked sample, they are using physicsmaterial which i made in Test 2 as i explained above, in that way i can`t find to control velocity and cant reset position! Also i would like to understand why paddle acting like a wall why i cant hit back ? Thanks…

Can you show the collision mesh for your paddle? Are you using a simple or complex one?

Any specific reasons why you are using a projectile as your ping pong ball instead of a simple sphere with physics on?

Last but not least, for very fast collisions you may want to enable CCD.

Hello @vr_marco,

Im using simple collision for the paddle because im getting some error with complex collision as you can see down below:

complexcollision.JPG

Using projectile cos i dont know how to bounce simple sphere with physics also i need velocity (i need to slow down ball a bit)… Im just simply playing own my own against wall, ball start bouncing on the table, if the ball hit the ground its star bouncing default position (in front of me) again…

And CCD already on.

Here you can see the behave of the ball regarding to settings as first post (paddle in simple collision): https://youtu.be/rWbu9ZxPt6U
As you can see in the video ball hopping from paddle in standby position (like wall) but when i try to hit with paddle behaving weird !

@syhdesign I can’t see the video. Is it private?

Ovv sorry my bad now is public…

Thanks, watched it. So what changes from the time the ball bounces on the pad at the beginning and the time it leaves the pad and starts bouncing on the floor/table and comes back? How do you propel it from the pad when you want to launch it toward the wall?

It (ball) start bouncing on the table not on the paddle, when i put the paddle under ball path it is bouncing like as real life but this reaction only happening paddle stand by position ! whenever i try to give some force with my arm (hitting by armswing) it is reacting like snapping on paddle as you can see in the video !

Definitely there is something wrong with the collision settings/physics settings of the paddle. However it is not easy to pin point exactly what the problem could be without being able to see your project. Did you try to temporarily switch the pad with another mesh? Say a flattened cube. Does it work that way?

I tried with another static mesh which is simple box and same result unfortunately, i think that issue coming from default BP_PickupCube blueprint from vr template which i used for paddle. I will try to pickup object and stick to the hand without press and hold the trigger maybe i can fix with that way. Thank you Marco trying to help me, i will let you know if i can solve…

ProjectileMovementComponent will not work :

  • It’s not designed to work with translated or fast moving objects
  • Hit events and Overlap event are not fired in 99% cases against dynamic objects .
    -…

“hitting with the paddle is great but to fast cant control velocity of the ball" -> In My example there is a hacky way to limit the velocity . "cant reset location of the ball if the ball touch the ground” → Set All Linear Velocity to 0 - Then → Set location with Teleport “On”

And the god showed the light :slight_smile: thanks man @Mhousse1247 i will try…

Hello Dear All,

I just keep working on pingpong stuff and would like to make easy hit counter on the wall, logic is simple in the theory! when the ball hit the box collider (which is standing in the wall but a bit pop out) score will be counting and when the ball hit the ground score will be reset (0). But it doesnt work in the current blueprint system as you can see in the attachment. Do you have any idea ?

4.jpg

  1. pic: widget
  2. pic: widget graph
  3. pic: score blueprint include widget+box collision
  4. pic: score bluprint eventhgraph

Thank you.

@syhdesign You have to start applying some basic debugging techniques so you can identify by yourself where the problem is. Your debugging has to follow the code logic, starting from the Event you expect to be triggered all the way to the result (changing the score and visualizing it).

  1. First add a Print String between On Component Hit and Update Score. Set it to write to Log only because on screen messages are difficult to see in VR. Give it a meaningful string and add some unique characters so it is easy to find in the log. You can use “!!! On Component Hit (countersurface)” or something similar, then you can search the log for just “!!!”. Now play your game and hit the countersurface a couple of time. Stop it. Check the log. Did you get any hit? If not, your problem is that the On Component Hit event doesn’t fire. Then you have to figure out why.
  2. If the On Component Hit event fires, next you need to check what happens inside Update Score. Put a Print String there to log the score being properly updated. Do you see the expected result? Does the score increase (or is it zeroed) as expected?

Keep going until you can pinpoint where your code doesn’t work as expected.

Once your exact problem has been identified, we can help you further with understanding why and finding a solution to it. Otherwise it is like shooting in the dark…