Scripts not functioning when scene is changed

Hi all,

In our new racing game, which is on the verge of completion, we are using scene changes to switch to the next race after winning the first one. Please check in https://playcanvas.com/editor/project/653630

However, when I change scenes to the next race, the code that detects the winning /losing collision stops working. If I run the scene independently, it works fine.

Could someone please tell me why this is so?

That’s a big project, could you provide an explanation on how that code works and where in your project lives?

Please check race 1 or 2 of any tier. The code is called finish.js.

What are the controls? Space to speed up, how to change gear?

Keep loosing so I can’t test level win/change.

Space to accelerate, click the gearknob to shift. Shift once the RPM is b/w 6000 and 7000.

Either I am not really good at this game or something is buggy. I keep pressing space to accelerate, RPM hits the maximum, then I shift to 2nd gear.

But rpm is still at maximum engine doesn’t seem to be affected by the any gear, is that expected? And I can’t really tell what is my speed, if I am speeding or not.

Which scene are you on?
The game works fine for me. Speed is reduced especially if you shift too late.

Tier1 - Race2 and pressed launch:

Give me a moment, I’ll be there.

You don’t seem to be on the scene. Do not notice your icon @Leonidas.

Sorry I had to go, debug this and let me know if there something I am doing wrong.

For your initial issue if you can create a simple repro scene that it’s very easy to arrive first at the end of the race and win, I will give it a try later.

There are no bugs. I just won :grinning:
This is how.

Here is my screen cast from my previous try, holding space and shifting:

This isn’t going to get you to the flag first @Leonidas.

Don’t let the car rev to the limiter. Or you will be too slow to beat the opponent. If you notice, the game says you shifted late.

Also, I forgot to mention(very sorry). Try not holding space and shifting at the same time. Just like a real car, where you don’t press the clutch and gas at the same time.

Right, I expected that even though I am holding the gas the engine will rev down as soon as I shift up.

As expected by a real engine. I think also including the current speed of the car in the UI will help tons understanding what exactly the car/engine are doing.

I’ll do that.

1 Like

Just cheat by shifting up to 5 before the race starts and that be enough to win the first few races. Couldn’t repro the bug though.

I’ll send a screen recording across. Also, thanks for finding another one. I’ll make sure one can’t shift before the race starts.

Well, shifting ahead of time should be allowed IMO. It should just result in horrible performance is all.

All right. I’ll try both and see which works out better.

@yaustar can’t repro it now either. Could it be browser only?