playMaker

Author Topic: sphere Check to array (get every collider within radius)  (Read 4636 times)

kiriri

  • Hero Member
  • *****
  • Posts: 506
sphere Check to array (get every collider within radius)
« on: September 18, 2012, 04:09:51 PM »
Here's another sweety :D I used it for grenades, but it has just soo many uses. If you want to get colliders within a certain radius of your object, this is for you.
Btw. Jean, have you ever considered writing a "Making of" of arraymaker? I don't really understand stuff like how the class context (ArrayListActions suddenly makes everything miraculously happen) works :S .

Cheers!

note:
multiple colliders mean multiple times the same mesh in the list. You'll need to manually make sure you don't process one twice.
« Last Edit: September 19, 2012, 09:40:32 AM by kiriri »
Best,
Sven

Andrew.Lukasik

  • Full Member
  • ***
  • Posts: 134
    • my twitter @andrewlukasik
Re: sphere Check to array (get every collider within radius)
« Reply #1 on: September 18, 2012, 04:20:47 PM »
That one was surely needed!
Doing this by looping x actions is kind of slow. Thank you, I will test it shortly

(ps: name like "GetCollidersInRange" or something like that would be more clear imho)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: sphere Check to array (get every collider within radius)
« Reply #2 on: September 19, 2012, 01:44:06 AM »
Hey Kiriri!

 I am really happy that you are doing custom actions for arrayMaker!!!

 I wish I could do a lot more of course, but I am just on the edge of time management ( my fault really...) and a making off ArrayMaker would take way too much time at the moment, tho I like the idea.

 here is the basic anyway.

 the array and hashtable component are simple component hosting the array and the hashtable. to avoid duplicating code inside each and every custom action, I moved all the various checks, common functions to find the proxy, etc etc into a class that I extend then in my custom actions. This way, it's a lot more efficient in terms of code management.

 that's all there is to it really.

 I strongly encourage you to go and open this ArrayListActions script and see for yourself. It simply go find and check for the proxy, if it exists, if it's valid, etc etc.

bye,

 Jean

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: sphere Check to array (get every collider within radius)
« Reply #3 on: September 19, 2012, 09:38:13 AM »
glad I'm not the only one who needed this :D

Thanks jean, tbh, I wasn't really expecting you to have the time for a making of. It's obvious you're already loaded ;) Would be cool though :)
Looking into the arraymaker files, I think I somewhat getting the hang of it. Awesome documentation o.o !

@Andrew: good point, I'm always a bit unsure what to call stuff. You know, a programmer wouldn't ever search for Get Colliders in Range to find this function... a tag search might be cool in such contexts... I'll propose it right now :)
« Last Edit: September 19, 2012, 09:41:56 AM by kiriri »
Best,
Sven