BB8-Commander icon indicating copy to clipboard operation
BB8-Commander copied to clipboard

[IDEA] Has anyone played with Collision Detection?

Open saraford opened this issue 9 years ago • 3 comments

Hey all,

I've noticed the collision detection is hit or miss. I've followed this Issue to tweak the sensitivity, but it is unreliable. I can pick up BB-8 and a collision is detected. But BB-8 can run into a wall and lose its head and no collision detected. Seems that the collision has to be at a certain spot on the ball.

Curious if anyone else has tried to play with collision detection.

Here's my code:

module.exports = function (bb8) {

  console.log("Waiting for a collision");

  bb8.detectCollisions();
  bb8.color("green");

  bb8.configureCollisions({
    meth: 0x01,
    xt: 0x20,
    yt: 0x20,
    xs: 0x20,
    ys: 0x20,
    dead: 0x50
  });

  bb8.on("collision", function(data) {
     console.log("collision detected");
     console.log("  data:", data);

     bb8.color("red");

     setTimeout(function() { bb8.color("green"); }, 1000);
  });

  bb8.roll(200, 0);
}

saraford avatar Jul 23 '16 01:07 saraford

Hi Sara,

I tried to play with the collision detection when I was working on the drive mode and I too echo your thoughts that the detection is unreliable. It can be added as a fun feature but I guess cannot be taken for granted.

On Jul 22, 2016 9:56 PM, "Sara Ford" [email protected] wrote:

Hey all,

I've noticed the collision detection is hit or miss. I've followed this Issue to tweak the sensitivity https://github.com/orbotix/sphero.js/issues/48, but it is unreliable. I can pick up BB-8 and a collision is detected. But BB-8 can run into a wall and lose its head and no collision detected. Seems that the collision has to be at a certain spot on the ball.

Curious if anyone else has tried to play with collision detection.

Here's my code:

module.exports = function (bb8) {

console.log("Waiting for a collision");

bb8.detectCollisions(); bb8.color("green");

bb8.configureCollisions({ meth: 0x01, xt: 0x20, yt: 0x20, xs: 0x20, ys: 0x20, dead: 0x50 });

bb8.on("collision", function(data) { console.log("collision detected"); console.log(" data:", data);

 bb8.color("red");

 setTimeout(function() { bb8.color("green"); }, 1000);

});

bb8.roll(200, 0); }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mintuz/BB8-Commander/issues/23, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJcu9mkNirIzN3rqUAXhft3lclQYaQkks5qYXSsgaJpZM4JTQT1 .

Sud-Puth avatar Jul 23 '16 14:07 Sud-Puth

@Sud-Puth Thanks for the response! I tried adjusting the configureCollisions sensitivity to what I'm guessing is the lowest levels and still can't detect a collision. I'll ask on the Sphero repo if no one here has figured it out. Thanks!

saraford avatar Jul 23 '16 15:07 saraford

I just play with sphero edu app and i have the same problem coollision detection not working

clodio avatar Dec 16 '17 08:12 clodio