Sign in to follow this  

vehicle tracks

Recommended Posts

Assuming you know the basics of directX rendering etc.....

Find your wheel position and drop it down by the radius of the wheel, this will place your tire marks on the ground without the need for any collision checks.

add and subtract half the skid width from this point (I align this to the vehicles velocity but you could use the wheel orientation too), this will give you two points on either edge of the tire mark.

Setup a timer and at each step drop two of these points into a vertex buffer. The faster you drop the points the smoother your tire tracks will be.

Render the vertex buffer as a triangle strip and there you go - your wheel will trail tire marks.

there are a few refinments that can be added. If you store the data and fill your vertex buffer each frame you can keep track of the points ages and fade them out nicely as they die out.

If you can keep track of the wheels contact with the groun you can stop the tracks and draw a totally transparant poly to fill in the gap when you start dropping points again.

While the wheel is dropping tracks you can draw an extra poly that joins the last two points to the wheel position, if you dont do this each time you drop a section of track it will appear to pop into existance meaning the tracks trail behind your wheel slightly.

Hope that helps a bit.

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