[SOLVED] 2D collision problem

So i am new to this application and is asked to make a 2D game with 2 levels but for some reason after the first level, the collision for the coins and virus doesn’t seem to work. How can i be able to make the collision work after proceeding to the next scene? currently this is the script i have. Please i really need help

Hi @Kwangbae_IZONE and welcome! For the script above both entities need a rigidbody component and a collision component. Please also check the page below.

https://developer.playcanvas.com/en/tutorials/collision-and-triggers/

Thanks for the reply! i’ve already seen the link though i still can’t seem to understand why after the trigger part of my code the collision does not work

if(result.other.name == 'trigger') {

        if (counter == 5) {

        var SceneToOpen = this.app.getSceneUrl('Start Scene');

        this.app.scenes.loadScene(SceneToOpen);

        var CurrentScene = this.app.root.findByName('Root');

            CurrentScene.destroy();

       

        }

    }

Hi,

Can you tell me how small the collision area is of these items? I have often found that you can’t have a small collision object. If it is too small the collision does not get detected. One of the games I worked on included small stacks of coins to be picked up. I could not use the mesh based collision object for this. What I had to do is make the collision component a cube and larger than the small stack of coins. Trigger worked every time I walked over the item and picked it up.

Can you share a link of your project please?

Sorry for the late reply i change the game and made it work still thank you for your reply i really appreciate it

i think i finished the game however the problem i am now encountering is in publishing. when i publish the game it doesn’t seem to publish the exact thing i did in the editor.

Can you create a new topic for this please? For example with screenshots of the difference and eventually a link of your project.

1 Like

Hi! Can I ask how you were able to fix this problem? I’m experiencing the same issue :frowning:

Hi @ABIGAIL_MATSUO and welcome!

Can you please create a new topic for your problem? If you share some information and the editor link of your project it’s easier to help you.