Game Development Community

Selectively Ignore Collision

by Rafael S. · in Torque Game Engine · 10/23/2007 (3:12 pm) · 2 replies

Hey,

i just ran into a problem with the nature of how collisions work in torque.
i'm currently trying to realize some gameplay elements of a small multiplayer game in which several players have to hunt and catch another player who is playing a ghost. i have to be able to selectively disable wall-collisions for the ghost player only and allow him to flee through walls. but since he shouldn't be able to this all the time, and also not allow him to leave the designated building or play-area, i have to be able to do this on certain walls only and only if certain criteria are met, which rules out removing the collision for the ghost completely.
another way i figured to be a work around is "teleporting" him through walls, which just wouldn't feel the same way as just walking through.

if anyone got a reasonable solution to this problem i would be really thankful!
cheers,
raf.

#1
10/23/2007 (3:18 pm)
How I would do it:

-Create a new class called PermiableShape that is derived from TSSTatic
-Create a new TypeMask called PermiableShapeType and assign it to this class
-Add PermiableShapeType to the collision mask in Player.cc
-In player.cc create a new collision type list called PlayerGhostCollisionMask, which uses the base collision mask, minus PermiableShapeType
-In the Player collision code, add a check if the player is a ghost or not, if they are, use the PlayerGhostCollisionMask, if not use the regular one.

You then build your level using PermiableShapes, and only "ghost" players will not collide with them.
#2
10/27/2007 (1:08 pm)
Or do it the other way around - the PlayerGhostCollisionMask has only PermiableShape on it. Then you simply stick invisible PermiableShape blocks inside anything you don't want the ghost to walk through.