Turning off Dif collision
by arteria3d · in Torque Game Engine · 01/30/2005 (11:34 am) · 27 replies
Does anybody have any idea how i can disable collision on a dif???
About the author
Owner of uk based Ltd company ArteriaMediaLtd. with a trading name of Arteria3d Website;arteria3d.com
#2
I am not on about transparency in the normal sense - removing parts of the texture u want invsible - more, just making the object see through?
01/30/2005 (11:43 am)
Cos, i wish to use (the poor mans....as u say) effect of simulating water reflections using a mirror. When i insert the mirror under the water item, i obviously need the collision turning off. Why on this subject - do u know Stephen how i can make an object see through, i.e. altering its alpha?I am not on about transparency in the normal sense - removing parts of the texture u want invsible - more, just making the object see through?
#3
Or, wait for TSE, since I'm almost certain it will have fully reflective material capability via shaders :)
01/30/2005 (11:57 am)
I don't have any real bright ideas on how to accomplish what you want..best I can think of is to copy the functionality of the mirror to a new render object similar to the generic render object resource Melv May provided a while back, or simply implementing OpenGL rendering for waterblocks directly, instead of trying to twist the mirror to provide what you want.Or, wait for TSE, since I'm almost certain it will have fully reflective material capability via shaders :)
#4
01/30/2005 (12:31 pm)
Somewhere in the forums I remember seeing something for reflective water...if I find it, i'll post the linkie here.
#5
In interiorInstance.cc on line 239 in InteriorInstance::InteriorInstance() add:
on line 329 in InteriorInstance::initPersistFields() add:
on line 1313 in InteriorInstance::buildConvex() add:
on line 1438 in InteriorInstance::packUpdate() add:
on line 1462 in InteriorInstance::packUpdate() add:
on line 1526 in InteriorInstance::unpackUpdate() add:
on line 1562 in InteriorInstance::unpackUpdate() add:
In interiorCollision.cc on line 1221 in InteriorConvex::getFeatures() add:
on line 1399 in InteriorConvex::getPolyList() add:
01/31/2005 (12:56 pm)
In interiorInstance.h on line 235 add:bool mCollidable;
In interiorInstance.cc on line 239 in InteriorInstance::InteriorInstance() add:
mCollidable = true;
on line 329 in InteriorInstance::initPersistFields() add:
addField("collidable", TypeBool, Offset(mCollidable, InteriorInstance));on line 1313 in InteriorInstance::buildConvex() add:
if (!mCollidable)
return;on line 1438 in InteriorInstance::packUpdate() add:
stream->writeFlag(mCollidable);
on line 1462 in InteriorInstance::packUpdate() add:
stream->writeFlag(mCollidable);
on line 1526 in InteriorInstance::unpackUpdate() add:
mCollidable = stream->readFlag();
on line 1562 in InteriorInstance::unpackUpdate() add:
mCollidable = stream->readFlag();
In interiorCollision.cc on line 1221 in InteriorConvex::getFeatures() add:
if (static_cast<InteriorInstance*>(mObject)->mCollidable == false)
return;on line 1399 in InteriorConvex::getPolyList() add:
if (static_cast<InteriorInstance*>(mObject)->mCollidable == false)
return;
#6
01/31/2005 (1:12 pm)
Heh, when I first read this query, I thought 'Hmm, thats a question for our resident collision expert', and here you are.
#7
How do i determine though which is to have collision and which to not?? For example - the mirror block - obviously needs it turning off - but not for everything else - how would i signal that please?
01/31/2005 (1:44 pm)
Thanks Mathew.How do i determine though which is to have collision and which to not?? For example - the mirror block - obviously needs it turning off - but not for everything else - how would i signal that please?
#8
01/31/2005 (2:08 pm)
You open up the Mission Editor and click on the building you want to not be collidable, expand the "Misc" group and you will see a checkbox for collidable. Check/uncheck and hit apply, then save your mission.
#9
Nick
01/31/2005 (2:40 pm)
Matthew, lets say you have distant buildings that the player will never collide with that are used just for decoration. Will disabling collision on those buildings improve FPS?Nick
#10
Stevie
01/31/2005 (2:43 pm)
Mathew thankyou very much for sorting this out mate - much apreciatedStevie
#11
01/31/2005 (4:03 pm)
@Nick: No. Collision only incurs a performance hit if you're colliding with something.
#12
Nick
02/01/2005 (1:14 am)
Ok, thanks. I won't bother turning off collision on distant buildings then.Nick
#13
it's not liking
if (static_cast(mObject)->mCollidable == false) return;
j:\Torque\engine\interior\interiorCollision.cc(1221): error C2227: left of '->mCollidable' must point to class/struct/union
j:\Torque\engine\interior\interiorCollision.cc(1221): error C2440: 'static_cast' : cannot convert from 'SceneObject *' to 'InteriorInstance *'
06/26/2005 (11:52 am)
Can't get it to work with 1.3it's not liking
if (static_cast
j:\Torque\engine\interior\interiorCollision.cc(1221): error C2227: left of '->mCollidable' must point to class/struct/union
j:\Torque\engine\interior\interiorCollision.cc(1221): error C2440: 'static_cast' : cannot convert from 'SceneObject *' to 'InteriorInstance *'
#14
06/26/2005 (1:31 pm)
Have you done a clean rebuild? Do you get ay other errors? That cast should work pretty much regardless of the type hierarchy; maybe try doing a (InteriorInstance*) instead of a static_cast?
#15
06/26/2005 (1:35 pm)
Yeah, it's a clean rebuild. i thought that might be the issue. In the code you add that line i stated above twice in one CC file, and for each line it gives me those two errors. perhaps maybe i added some of the other code in the wrong spot. seems like this code wasn't specifically for 1.3 so when it says add this line X, it doesn't seem to match up where it should belong. but even so... the rest of the code is pretty much just for collidable, which i'm not getting complaints about.
#16
if ((InteriorInstance*)(mObject)->mCollidable == false) return;//ramen
i changed it to either of them and i get this error instead
j:\Torque\engine\interior\interiorCollision.cc(1225): error C2039: 'mCollidable' : is not a member of 'SceneObject'
06/26/2005 (2:23 pm)
If (!((InteriorInstance *)(mObject->mCollidable))) { return; }if ((InteriorInstance*)(mObject)->mCollidable == false) return;//ramen
i changed it to either of them and i get this error instead
j:\Torque\engine\interior\interiorCollision.cc(1225): error C2039: 'mCollidable' : is not a member of 'SceneObject'
#17
06/26/2005 (2:58 pm)
...
#18
j:\Torque\engine\interior\interiorCollision.cc(1227): error C2227: left of '->mCollidable' must point to class/struct/union
06/26/2005 (3:09 pm)
J:\Torque\engine\interior\interiorCollision.cc(1227): error C2027: use of undefined type 'InteriorInstance'j:\Torque\engine\interior\interiorCollision.cc(1227): error C2227: left of '->mCollidable' must point to class/struct/union
#19
06/26/2005 (3:24 pm)
...
#20
bool mCollidable; within class SceneObject : public NetObject, public Container::Link and it stopped giving me errors using the original code. but in game it's not working... so i'm sure i gotta sort out where these streams need to go.. that's providing me putting that bool where i did isn't the problem.. but it compiles...s o...
06/26/2005 (3:27 pm)
I placed bool mCollidable; within class SceneObject : public NetObject, public Container::Link and it stopped giving me errors using the original code. but in game it's not working... so i'm sure i gotta sort out where these streams need to go.. that's providing me putting that bool where i did isn't the problem.. but it compiles...s o...
Torque 3D Owner Stephen Zepp
In other words, what root effect or functionality are you trying to accomplish? It's most certainly done better via a different mechanism.
.dif's (interiors) are all about collision--it's pretty much what they are designed for.