Jump to content
  • Advertisement
Sign in to follow this  
jlewicki

"bending" a texture

This topic is 4126 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!