0 Favourites

Picking by radius or "Volume Box"

  • Hello

    I need advice on what would be best approach for this example.

    When character has magnet mode on, if there are Type: Large Metallic objects in certain radius player will be drawn to it, and if there are Type: Small metallic objects in radius they will be drawn to player.

    there is only 1 character and could be many metallic objects, should i attempt radius calculations or try whats seems to be simpler attach volume box to character and try picking overlapping objects?

  • Either way really. The only issue is when using system expressions to pick, you will need to use a for each on the object that will do the picking.

    For each magnet distance(self.x,self.y,annode.x,annode.y) < n do stuff.

  • oh thanks!

    I didn't know there was distance expression.

    i came up with something of my own, and just out of curiosity can't figure out why its wrong ;/

    <img src="http://i.imgur.com/60vR4.jpg" border="0" />

    :D my idea was that if difference between X was larger than radius (6) it would return positive amount and when added to Objects X the result would be automatically more then Objects X and event would not trigger.

    oh nvm figured out

    it was to be greater then or equal to

  • Well that's just x. If you want to go that way then I would suggest the overlapping at offset condition.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • nah distance is cleaner thanks :D

    I was just curious why it didn't work at first

    <img src="http://i.imgur.com/Q53BM.png" border="0" />

    ended up with something like this, now Just have to figure out how to stop objects pushing when they already collided with target "Magnet"

    otherwise smaller objects fly the robot offscreen :D

  • hm weird, when I use distance all objects regardless of distance are affected, when using X comparison with combo with Y comparison

    only objects close enough get impulse

    I got i must use picking command in combo with distance but not sure how :S

    <img src="http://i.imgur.com/Lpg5a.png" border="0" />

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