Calculate drag properly, remember that we use kg/in³ and in/s² - fuck knows how what I was doing before worked in the slightest, this feels much better
Bounce a bit higher
Only use this paddle sound, it's cooler
Alternating client authoritative networking
* Implement an alternating client authoritative model - whichever clients side of the table the ball is on gets complete authority over the ball position and velocity.
* Physics are simulated entirely on the current authoritative client now. Pack the ball position into the UserCmd and the server sets the ball entity's position so the other client can see it and takeover when authority switches.
* Substep the physics at fixed(ish) 0.005ms steps within FrameSimulate's delta time, each step moves the ball and checks against the paddle sweep. This may be unconventional but it gives us a perfect result and never misses.
* Fix paddle collision sometimes sending the ball backwards because of a negative velocity length, added an abs.
Neater way of giving client authority over the ball
Implement physics substeps on a fixed-ish time step within FrameSimulate, move the ball and try to collide with the paddle each step - this is probably quite unconventional but it gives us the perfect result and never misses
Use abs on our paddle return velocity length before multiplying by the sweep normal, stops the ball flying behind the paddle
Simulate physics entirely clientside each frame, make the client authoritative packing the ball position into the usercmd. The game should decide which client is authoritative based on which side of the table the ball is on.
Sweep trace the paddle into the ball, way way more reliable, setup a nice cylinder hull for the paddle too
Better physics, account for paddle angular velocity, original ball velocity reflects, and resolve movement after we've been hit instead of before
set ident to facepunch.tabletennis
Can drop the ball with your left hand by pressing X, and transfer paddle velocity into the ball on hit. Need to do this better by figuring out local velocity of the point from the angular velocity of the paddle.
Move the paddle a bit further down so you're actually holding it
Make surface assets for the ball, paddle and wood with realistic restitution values (can you hook these up to the models/materials @bakscratch)
Tidy up our physics code a bit and use the restitution coefficients
Set MaxPlayers to 2
Oops, make sure it's this paddle that's colliding with the ball
Put different client pawns at the end of each table
how'd I cock this up
Improve VR anchor positions
Turn the paddle around, black side is back hand I think?
Better test camera position & fov so I can see wtf is going on
Add a PlayerPawn which has a Paddle which tracks the ActiveBall
Paddle hits the ball from a Simulated context, if the ball hit the paddle it'd be shite, do this from Simulate so it can be predicted/clientside authorative
Also get some bounce / hit sounds going
Hook our paddles up to Input.VR.RightHand and set our anchor position, can whack balls in VR now