How to implement the yellow part of this route with PlayCanvas?

Any ideas?

1 Like


Hi @11113 and welcome,

Could you make your question more specific?

Do you have already in place a race truck and you are looking to create power ups like that? Or just looking on how to create curves?

If it is the latter then that it is something you would be doing generally in your modeling app.

For detecting when the player enters a yellow segment and activating a power up, take a look at this tutorial:

Thank you for your answer.@ Leonidas The car is ready. Now I do n’t know how to achieve the trimming effect of the yellow part. The yellow area moves with the car. How can I achieve that function in playcanvas?

The question to that would be very much dependent to your project and how you are modelling and coding the truck and car.

Try posting a sample project to take a look, might be able to help you out.

For example, the car moves to the yellow area 0_Easy_Drift_0_R_E_BonusTurns. How can the effect of the yellow area be the same as in the video and move along with it?

I can’t think of an easy way to do that effect.

Otherwise, you could implement that effect using a shader with a uniform (a parameter that changes over time) that monitors the position of the car over the mesh.

I haven’t done something similar but I would imagine either a vertex shader that displaces the vertices making the mesh “disappear” under that car, or a pixel shader that changes the UV of the rendered material.

But without maps, modifying the UV is invalid

You could have a map that holds the two road colors (yellow and non-yellow) and using a shader mix between the two based on the position of the car.

Sorry I don’t have a sample to help you out with this, you will need to do some studying on GLSL for this.

Can you do it simply? please!

Have set you up as an administrator, this will be a good example for you!

Hey, thanks though I don’t have the time available for that right now.

I’d say if you like share a public project url here and maybe someone can step in and help you out with this.

It’s a public project and it has been shared with you. I don’t think anyone can help me. Only your official people can help me.

You never know :slight_smile:

Posting your project url:

Please help me if you have time later, thank you!!!

1 Like

I think of a way, it seems that the tailing system method can be used to solve this problem.

Ah yes, there’s a trail effect example of the forums that could work for this :thinking:

I am fairly sure I would use a method like the one @Leonidas suggested. For yellow sections. map texture V from 0 to 1 down the length of the track where the yellow segment is. Then, as the car drives down that section, calculate its progress from 0 (start of yellow section) to 1 (end). Then use that as a fragment shader uniform value. If the texture V is less than the car progress value, sample the track texture, otherwise, output yellow.