-
Notifications
You must be signed in to change notification settings - Fork 72
Animate Ramps on ball contact #542
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededphysicsRelated to the physics engineRelated to the physics enginerenderingConcerns the HDRP or the URPConcerns the HDRP or the URP
Milestone
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededphysicsRelated to the physics engineRelated to the physics enginerenderingConcerns the HDRP or the URPConcerns the HDRP or the URP
Real ramps in pinball machines vibrate when the ball passes through, because ramps are not 100% rigid. The goal of this issue is to create a vertex shader that animates the ramp mesh in a natural way when the ball passes through, to emulate this vibration.
The main difficulty is that the ramp mesh doesn't move uniformly but is dependent on a) the ball position and ball velocity and b) on the points where the ramp is attached to the playfield, which are more rigid than parts further away from the attachement points.
a) can be retrieved from the physics engine. For b), a rigidity map will be provided where the black means no vibration and white full vibration. The map can be assigned to the shader.
The animation itself should be sin/cos-like movement for each vertex, in the direction of collision normals betwen the ball and the ramp. It's not wave-like but the whole object is moving, with the strength depending on the rigidity map and a global strength parameter. The frequency is also defined by a global parameter.
Write the vertex shader based on the HDRP/Lit shader, with a parameter of the vibration strength and frequency.