Can magnitude be used for...
Kangavark
Member Posts: 62
determining the distance between two instances of the SAME actor? Or must they be different actors completely? If they must be different, I was thinking of this workaround:
I would have each instance of actor A (say there are 3 on screen) spawn under it actors B, C, or D (constrain to actor A's X & Y, and make them invisible) and use magnitude to determine the distance between them. Could that work? I'd try it myself, but I'm not at home at the moment.
any thoughts?
I would have each instance of actor A (say there are 3 on screen) spawn under it actors B, C, or D (constrain to actor A's X & Y, and make them invisible) and use magnitude to determine the distance between them. Could that work? I'd try it myself, but I'm not at home at the moment.
any thoughts?
Comments
Yeah, that should work.
Insightful thinking!
Sincerely,
King Chakku
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
This is what I would do, but if you are having difficulties with magnitude, then I have an alternative!
(This is what I'm considering for the AI in one of my upcoming games; it may be irrelevant depending on what you're using the magnitude for, but is relevant many cases)
Constrain a circular actor to the actor you intended on using magnitude on, and work with the collisions of the constrained-circle actors!
Hope this helps.
@tatiang
I'm not on my computer right now, but will try out your demos as soon as possible and update this thread if one of your demos was a better/easier solution.
Sincerely,
King Chakku