Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   collision detection in myFirstMethod (http://www.alice.org/community/showthread.php?t=11391)

coynerm 12-16-2015 11:47 AM

collision detection in myFirstMethod
 
version Alice3:

I had to put a while loop in myFirstMethod() in order for the collision detection functions to detect/work. makes sense now that i think about it...keeps looping/scanning for collision events...right?

New problem: counter variable keeps incrementing b/c each collision is counted multiple times b/c its in a while loop. fixed this by moving object away so it doesnt multiple detect collision. is there a way to delete or remove an object from a running program upon collision? ie pirate ship collides w/ iceberg so iceberg is deleted/removed.

thx for any feedback.
Mike

MrMoke 12-16-2015 12:50 PM

Sink it below the surface. You can't collide with it if it's out of reach. ;)

RavenOfCode 12-17-2015 04:21 AM

There is no Destroy method, but you can use the SetActive method to turn it off. It will not collide then.

chickentree 12-17-2015 02:03 PM

Events
 
[QUOTE=coynerm;56955]version Alice3:

I had to put a while loop in myFirstMethod() in order for the collision detection functions to detect/work. makes sense now that i think about it...keeps looping/scanning for collision events...right?

New problem: counter variable keeps incrementing b/c each collision is counted multiple times b/c its in a while loop. fixed this by moving object away so it doesnt multiple detect collision. is there a way to delete or remove an object from a running program upon collision? ie pirate ship collides w/ iceberg so iceberg is deleted/removed.

thx for any feedback.
Mike[/QUOTE]

A better approach might be to use an event rather than an infinite while loop.

Mark


All times are GMT -5. The time now is 01:45 PM.

Copyright ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.