Game Development Community

Any way to disable collisions without hiding the mesh?

by University of Central FL (#0003) · in Torque Game Engine · 04/23/2006 (1:24 pm) · 9 replies

I was wondering if there's any way to disable collisions on an object without hiding the mesh. I am trying to have a blob "absorb" an object, which will include mounting the object to the center (inside) of the blob. The blob is going to be somewhat transparent, so I want the object to be visible inside the blob. This is why I didn't use %obj.setHidden().

Any ideas?

p.s. I would like to do this from script if possible, but I can edit engine code if needs be.

#1
04/23/2006 (1:59 pm)
If you make it an Item, you should be able to use
%myitem.setCollisionTimeOut(%theblob);
although that's only for a limited time, so you'll have to change the engine source to make this permanent... but it should give you a starting point
#2
04/23/2006 (2:55 pm)
Here's some super simple C++ code i wrote that will let you disable collision using a console function. I had some camera shaking issues, but i don't know if it will have the problem for you.

ConsoleMethod( ShapeBase, disableCollision, void, 2, 2, ""){
   object->disableCollision();
}

ConsoleMethod( ShapeBase, enableCollision, void, 2, 2, ""){
   object->enableCollision();
}

to use it, put that c++ in shapebase.cc. compile.

in script.... it's easy. %object.disablecollision();
#3
04/23/2006 (3:23 pm)
The camera shaking is probably because you're not updating this between the client and server so the client is looking for collision where the server isn't finding it.
#4
04/23/2006 (4:27 pm)
That's what I was thinking about doing, making enableCollision and disableCollision console methods, but that camera shaking would be a problem.

Paul, do you know how I can tell both the client and the server to ignore/stop ignoring collisions on a shapebase object?
#5
04/23/2006 (5:36 pm)
PackUpdate?
#6
04/23/2006 (8:30 pm)
Yeah, though I'm not exactly sure the best way to go about it... adding a boolean variable to shapebase and pack and apply it based on a mask setting is probably the "simplest"... after looking at the enable/disableCollision functions they change a var called mCollisionCount, which I'm not sure how that works exactly and how you would do a getCollisionStatus kind of check to just make it a mask and a toggle. Can probably update it using isServerObject checks in the right spots too, I think that's what I did when I fixed the projectile particles, though honestly I forgot how I did it now >.>
#7
04/24/2006 (6:42 pm)
Anyone have any other input on this subject? My producers are really set on this idea of absorbing an object (mounting the object to the player) and being able to shoot the object out of yourself. Right now I have a hack that works where I mount an image that looks like the object, then I shoot a projectile that looks like the object. It looks ok, but the functionality thst I need from the real object is nonexistant.

Any other ideas?

Thanks in advance.
#8
04/24/2006 (7:47 pm)
There a problem with disabling collision when it's a mounted object? Come to think of, shapebase has all sorts of code for mounted objects, and you could just disable their collision in the onMount unMount or whatever they're called functions.
#9
04/25/2006 (7:44 am)
Nah the mounting has nothing to do with it. I want to mount it and unmount it later, but that has nothing to do with the fact that I don't know how to disable/enable collisions on a player object.

I know engine code has enableCollision() and disableCollision(), and I know you can expose these fucntions to script, but from what I've seen, this isn't enough to disable/enable collisions on a player object from script.

Anyone have any success with anything? I'm at my wit's end here lol.