How can I make user media or videos detect collisions? (Maybe using Drawing Canvas?)

0 favourites
  • 2 posts
From the Asset Store
Add SubRip (SRT) subtitles to your videos in Construct 3
  • I think I read a post about this. But I can't find it.

    For instance, if I recorded a video of my cat and wanted to use it as a boss, without turning the video into a sprite.. As in, have some kind of collision detection between the content of the video and other sprites on the layout. Even if I have to use a basic colour filter to make it easier.

    Is there a way to do this with video/user media? And going further, is it possible to create a kind of eyetoy/mario kart home circuit game?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The canvas plugin lets you draw objects onto it. If you’re able to draw the video onto the canvas you can then read pixels.

    That in and of itself doesn’t give you collision detection. Construct works with polygons, not pixels to collision detect.

    What you can do is read say 100 random pixels and create some square objects at each one if it’s on the cat. It would be enough to mostly detect collisions with the video, but it wouldn’t work well for having the cat in the video be able to push the player around.

    So in order to do that you’ll need to.

    1. Be able to draw a video on to a canvas.

    2. Read pixels from the canvas.

    3. Be able to tell if that pixel is on the cat or not. It’s easiest if the background is a certain color.

    Reading all the pixels and creating collision objects every frame would be pretty slow, so that’s why I suggested sampling 100 random pixels. The idea is just to get an approximate shape.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)