Game Development Community

Uncolliding

by baylor wetzel · in Torque Game Builder · 01/28/2007 (9:06 pm) · 2 replies

I know of onCollision. Are there any other collision functions or events?

What i'm looking for is something to tell me when a collision starts, when it ends and whether i'm currently colliding

i've got a couple of things i want to do. Here's one item: If the mouse is over an item, highlight it. i assume when i collide with the item, in the onCollision i swap sprites or whatever one does to highlight the item. If i move the mouse away, once i've left the collision bounds i want to stop highlighting. How do i know when a collision has stopped?

Another application: In a paper-doll, where i'm dragging an item into an inventory spot, model of a player, etc., if i let go of the button i want to know if the item i'm dragging is colliding with a specific item. If it's colliding with inventory square 7, i want to mount it to the center of that square. If it's over the player model, i want to mount it to the model's arm or somesuch. If it's not over anything interesting, the object disappears. i'm not sure how to tell if i'm colliding with something (yes, i could set a variable saying "you're over this object" in onCollision but, as mentioned above, i don't know how to detect when i've stopped colliding)

#1
01/28/2007 (9:30 pm)
What you are looking for is handled identically with triggers. Their callbacks are onEnter(%this, %object) onStay(%this, %object) and onLeave(%this, %object), where %this is the trigger that called the callback and %object is the object colliding/leaving etc.

Create them is the level editor, give them a class and make sure their callbacks are set to true.

I need to get to bed but I will gladly give a more detailed explanation if you need it tomorrow.
#2
01/28/2007 (9:41 pm)
Great to know. i'll give that a try