Sign in to follow this  
jlewicki

"bending" a texture

Recommended Posts

I'm making a pong game and would like to create a "trail" behind the ball. the problem I am having is coming to a solution for what happens when the ball hits the wall and the texture needs to reflect by either bending or creating a "V". i figure one partial solution would be, is to create a list that starts with one object (trail) in it. if the ball hits a wall i place another trail into the list. the trail would be made by finding the distance between the ball and the wall, then taking the angle of reflection and transform the texture by that angle. then take a RECT with a length of the ball/wall distance. ----- I'm sure this will look really ugly, even if it comes out correctly... ----- Is there an alternate solution? how is this kind of "trail" possible? 17 seconds into this clip there is a pop-fly, look at the ground, there is a pale/gray trail"

Share this post


Link to post
Share on other sites
The 'best' way to do this is going to depend on how your engine is coded and what looks right to you. Some ideas/things to try:

-Constantly spawn new trail particles at the ball's position but with reduced velocity and fade them out quickly. You might not even need to perform collision detection with the walls if the particle lifespan is short enough.
-Store the ball's last (10? 20?) positions and render some sort of particle animation at those positions that fades out as it approaches the oldest position. Jitter the positions randomly between the points for a more random effect.

IMO procedurally creating a retroactive trail is overkill; surely you can use whatever code reflects the ball for you to your advantage here (as with suggestion 2 or by some other way.) The basic difference between what you were thinking and what I'm suggesting is the use of multiple particles to improve the trail simulation and make the coding easier (assuming you are familiar with particle systems.)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this