[SOLVED] Rigidbody Issues

Hi guys,

The new release which was released some time ago has broken the scoring in my game,
In this version, (using the older engine version it was working correctly). I even updated to the latest version of Ammo.

Old build (Working correctly)

but in this latest one, the scoring is bugged.

If you try to land the ball inside the rings, the first one will work correctly while the below one will not.

I found the culprit are the trigger colliders, and this is how I am calculating where the ball landed (as they can be dynamic in size from the API):

Capture.PNG

I have cylinder trigger colliders with the biggest one of the outer circle, and I am keeping a stack and onTriggerEnter I push that trigger colliders number in the stack while onTriggerLeave I pop out the number from the stack hence the top most number in the stack gives me the ring number of where the ball landed, and if its empty it didnt land in any of the rings.

What currently is happening is this in the Logs if I run with the new engine and try to land in Ring 2:
This is printed in the console:

In Ring 5
In Ring 4
In Ring 3
Out Ring 5
Out Ring 4
Out Ring 3

While on the older build this printed:

In Ring 5
In Ring 4
In Ring 3
In Ring 2

And as ring 2 was the top most element in the stack I would know that the ball was in ring 2, but now its messed up.

ScreenShot of the wrong scenario, the ball is in Ring 2, while the triggers printed the following log:
C mean circle
In C5
In C4
In C3
Out C5
Out C4
Out C3
Stack is empty so No points scored! (log came)
Capture.PNG|690x324

In the older version,
This printed:
In C5
In C4
In C3
In C2

And since C2 was the top most element, I would give him 200 score.

@will I would request to get this fixed as soon as possible as we have to release the game soon.
I can add you to the project.

Thanks.

1 Like

A quick tip for anybody that encounters a regression in a new engine release. You can step back to the previous stable build by following the guide here:

https://developer.playcanvas.com/en/user-manual/scripting/custom_engine/#launch-with-a-previous-stable-engine

Can I be added to the project to investigate? Username ‘will’.

Added you Will, one question: Can we make a build with the previous version of the build, since we are deploying the game using the playcanvas link (iframe).

Thanks

Yes! Definitely. Just download a ZIP and swap out the engine in the root of the ZIP with:

http://code.playcanvas.com/playcanvas-1.27.4.min.js

Sorry for the confusion, Will I was asking about the head link which Playcanvas creates, I am using the playcanvas head link on the website right now. I was saying if when I create a new build, (the head link) does it grab the latest engine and makes the build? and If I want to specify an older engine for the head link, is that possible?

Oh, yeah, if you publish to the https://playcanv.as domain, you can’t use an earlier engine. Don’t worry, I’m sure we can fix it. :smile:

1 Like

Hi @will

I have made a video illustrating the issue, as you can see in the video, I have subscribed the trigger to TriggerEnter and TriggerLeave, while if you see in the console, its just spamming out the logs, In Circle5, Out Circle5, making it look like its triggering the enter and leave function repeatedly.
Here the video with the current Engine:

And if you check out this video, The game running with Previous Vs current engine, you will get an idea of the issue.
It seems the onTriggerEnter and onTriggerLeave are being called alot for some reason in the new version even though if you see in the video when I run it with the previous verson, there is no spam like that in the console.

Please let me know if anything else is required from my side, Thanks

Fix deployed as 1.28.2. Let me know if that resolves the problem.

2 Likes

Hi Will,

Yes, its working correctly, Thank you for quick fix.

3 Likes

By the way, while I was debugging this problem. I noticed that there are many optimizations you can make to enable your project to load faster and perform better on lower end devices. For example:

  • flower_road_4k.jpg is 4096x2048. It’s 6.3MB and much larger than is necessary.
  • Consider unchecking ‘Preload’ for all of your mp3 sounds. It’s probably not necessary for them all to be downloaded at the moment the game starts.
  • Your LoadingScreen.js has a 1MB Base64 encoded PNG embedded in it. This could definitely be optimized. Or you’ll need a loading screen for your loading screen. :wink:
  • You have duplicated or unused assets. For example, search your Assets folder for the word ‘exit’ and you’ll see several version of the same asset. Deleting unused stuff is generally advisable.
1 Like

Thanks Will for the recommendations,
I will do those optimizations right away!