Jump to content

How to use Observer - Trigger Ball - Switch

Recommended Posts

player_box.body.grounded = false;				
player_box.body.collisionResponse = 0;
player_box.body.addEventListener("collide", function(e){ player_box.body.grounded = true;
player_box.body.collisionResponse = 1;

   player_box.body.grounded = true;
   player_box.body.velocity.y = 0;
   player_box.body.grounded = false;	


Just add an event listener to the physics body for a collide.

Link to post
Share on other sites

nice to see this alternative. I'll try it. Can you tell me which API are you using here? Is this cannon's API?

I know that that is possible. And I like this alternative

scene.registerBeforeRender( function() {
    if (ball.intersectsMesh(switchForBall, false)) {
        console("ball mesh intersect switchForBall");

But I really would like to know if onCollideObservable works. Maybe Deltakosh should know. I think he is programirmg babylonjs API.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...