Level change when collison

i want it to change level when Character Controller collids with level end
becouase it would help me a lot for my game

gamplay now PlayCanvas | HTML5 Game Engine
game design PlayCanvas | HTML5 Game Engine

Hi @Jesse_Gagne,

You can use triggers for that! Check the following tutorial:

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

1 Like

i wish kids could do coding courses

1 Like

Start slow, find a short and easy Javascript course online (there are a lot of free ones) and you can learn basic coding concepts.

I knew a 13 year old kid who taught me how shadow mapping works back in the DirectX 9 era.

1 Like

so if i were to make a sound when collision with an object then

var Collider = pc.createScript('collider');

// initialize code called once per entity
Collider.prototype.initialize = function () {
    this.entity.collision.on('collisionstart', this.onCollisionStart, this);
};

Collider.prototype.onCollisionStart = function (result) {
    if (result.other.rigidbody) {
        this.entity.sound.play("step");
    }
};

right

how do i make the html insted of a script with my object tho

Yes that seems correct. One good way to learn is to fork (copy) the tutorial project and start trying to make small changes to the scripts. See when and how it breaks and what works.

PS Try to use the coding highlight feature when you post code snippets:

image

I didn’t fully get what you ask, but if you want to add an HTML interface on top of your game check these examples:

https://developer.playcanvas.com/en/tutorials/?tags=html

but is this js or what is it

Yes that’s JS, I believe @Leonidas was simply using your post to show you how to use the code highlight feature. To learn JS and PlayCanvas, start off here - Traversy Media’s JS Crash Course, and Daniel Wood’s ‘PlayCanvas Game Design Tutorials’..

1 Like