Game Development Community

Disabling collisions on mounted objects

by Luigi Rosso · in Torque Game Engine · 01/24/2002 (11:11 am) · 2 replies

I'm trying to disable collisions on staticshapes mounted on an object (in my case a player).

The mountobject method for the ShapeBase class contains this code snippet:

// Since the object is mounting to us, nothing should be colliding with it for a while
obj->mConvexList->nukeList();

Yet the object mounted on a player (I'm attempting to mount a sword) will still collide with the player it is mounted on as it becomes impossible to move (I'm guessing the two collision boxes are intersecting). Plus this snippet of code seems to want to disable the collision on the object with everything, I'd want to just disable it with the object it is mounted on.

I'm sure this can be done, I've taken a look at some Item class methods and noticed that the setCollisionTimeout one sets a property (mCollisionObject) to the a certain object and will then not disable collisions (obj->disableCollision()) with it until it times out.

So I tried the disableCollision() method on the object I mount on my player (in the engine, and I tried adding console commands for it). The commands do get sent but nothing changes with the console command. While with the the obj->disableCollision() in the mountObject method the object gets mounted but is then not visible (and collisions no longer work with anything). I know it's there as I tried a gettransform on it and it is moving with the player.

I think I'm still too much of a modder and looking at this the wrong way perhaps, would somebody be so kind as to help me out or at least point out why such things are happening?

Thanks for the read.

#1
06/17/2005 (2:53 pm)
I know this is an old thread, but did you ever find a solution? We are experiencing the same thing.
#2
06/19/2005 (12:40 pm)
Heh... Too funny.

I just ran into this issue myself. For our game we want mounted weapons and equipment on vehicles to be able to take damage and be destroyed independantly of the object they are mounted to.

I haven't tested this code yet (I wrote it during a 4am insomnia session), but I think it's sound.

Follow this thread and I'll keep posting my research.

I'm going to whip up some test models in the next day or two and see if that doesn't fix the problem. Since your project is far enough along, post in that thread and let me know if the codefix helps.