Question on accessing objects on map.
by Bo Bjering · in Torque 3D Professional · 05/05/2009 (12:51 pm) · 12 replies
Hi :P, got a question about accessing any and all objects (TSStatic in .mis file).
I am trying to access the players collision with object, to get the texture of the object the player is currently colliding with.
But, as i understand it, to get a onCollision, the objects needs to be create via a datablock.
The editor does not create them into a datablock (i think?) so how do i access every object that the player collide with ?
I tried a
But it seems to never be called, i did a armor::onCollision in console and it said "onCollision called -----..." just fine, but not when i collide.
What im trying to do, is "Texture based collision sounds", and im almost done (well, texture editor UI done, saving/loading in the materials, preparing the changed files information to post here and much more).
But i still need to check for what object player is colliding with, then find the texture that is on, check if it has sound attached to it, and then play it.
Last 2 is easy, finding out what object player is colliding with and what texture is attached to it, is harder.
So any info/help on those 2 things would be appreciated, if any of you have the time :)
I am trying to access the players collision with object, to get the texture of the object the player is currently colliding with.
But, as i understand it, to get a onCollision, the objects needs to be create via a datablock.
The editor does not create them into a datablock (i think?) so how do i access every object that the player collide with ?
I tried a
function armor::onCollision( %this, %obj, %col )
{
echo( "onCollision called ----------------------------------" );
}But it seems to never be called, i did a armor::onCollision in console and it said "onCollision called -----..." just fine, but not when i collide.
What im trying to do, is "Texture based collision sounds", and im almost done (well, texture editor UI done, saving/loading in the materials, preparing the changed files information to post here and much more).
But i still need to check for what object player is colliding with, then find the texture that is on, check if it has sound attached to it, and then play it.
Last 2 is easy, finding out what object player is colliding with and what texture is attached to it, is harder.
So any info/help on those 2 things would be appreciated, if any of you have the time :)
#2
www.garagegames.com/community/forums/viewthread/86575
05/05/2009 (1:01 pm)
Here is a solution that i think could be bent to do what you need. www.garagegames.com/community/forums/viewthread/86575
#3
05/05/2009 (2:43 pm)
Thanks, yeah that looks like it will work just fine :)
#4
Sadly
info->material = materials->getMaterialIns(TSShapeInstance::smRenderData.materialIndex );
Does no longer work, its in (the struct RenderData is in, but not referenced anywhere) so the material is always NULL.
also
if (triggeredLeft || triggeredRight)
{
....
}
Always returns false, apparently the states is never set / used.
ALOT of "bugged" / unused and unfinished code in this release it seems (leftover from TGEA and or Incomplete code (to be done).
Im unsure if i should create a bug report or what i should do, but its also the reason why the "footsteps (the ones currently in)" and decals when walking ect ect is not playing.
Had those 2 worked, i would actually be finished implementing it (i pretty sure of that) o well :P
As this is beta i forgive you GG :P, but i expect the code to be clean in release, unused code, leftover code gone, and the rest actually working :) alot of work finding what works and what not at the moment :)
05/05/2009 (4:53 pm)
Ugh..Sadly
info->material = materials->getMaterialIns(TSShapeInstance::smRenderData.materialIndex );
Does no longer work, its in (the struct RenderData is in, but not referenced anywhere) so the material is always NULL.
also
if (triggeredLeft || triggeredRight)
{
....
}
Always returns false, apparently the states is never set / used.
ALOT of "bugged" / unused and unfinished code in this release it seems (leftover from TGEA and or Incomplete code (to be done).
Im unsure if i should create a bug report or what i should do, but its also the reason why the "footsteps (the ones currently in)" and decals when walking ect ect is not playing.
Had those 2 worked, i would actually be finished implementing it (i pretty sure of that) o well :P
As this is beta i forgive you GG :P, but i expect the code to be clean in release, unused code, leftover code gone, and the rest actually working :) alot of work finding what works and what not at the moment :)
#5
I have a scratchpad with pages full of 'BAD' T3D details(not truly bugs), but as you said, it is way to early to complain about the messy c'code(but i will when the time comes, GOD help me i will voice my opinion at that time!) and confusing vestigial functions (TGEA1.8.1 also have leftover functions what did not seem to be in use, so unless they first cleaned 1.81 up, its GIGO).
05/05/2009 (5:34 pm)
Sad. I am currently pursuing my list of personal additions to TGE/TGEA and seeing what ones are easy to update, and what ones need extra work. At the rate im progressing I may arrive at the Material Friction features early tomorrow AM. Will report back once i arrive at a conclusion. I have a scratchpad with pages full of 'BAD' T3D details(not truly bugs), but as you said, it is way to early to complain about the messy c'code(but i will when the time comes, GOD help me i will voice my opinion at that time!) and confusing vestigial functions (TGEA1.8.1 also have leftover functions what did not seem to be in use, so unless they first cleaned 1.81 up, its GIGO).
#6
But yes, let me know if you find a fix for the material friction system (some code on the page you showed is already in apprently, the fix you did for the NULL texture is not working though).
05/05/2009 (5:51 pm)
Ah well, at least i got the code ready to implement when its fixed, so we can do Material based sound triggers, so much better way to do moving around sounds like grass,rocks,stone,iron,wood,squikywood, and whatever else and directly from material editor :PBut yes, let me know if you find a fix for the material friction system (some code on the page you showed is already in apprently, the fix you did for the NULL texture is not working though).
#7
05/05/2009 (6:01 pm)
It was a bitch to find the right ::castRay, but now that i know HOW to find what is needed, it should be rather easy. Im gone for next 2 hours, but will return right to this subject as now i am overly curious about it.
#8
05/05/2009 (8:41 pm)
If the player is not currently placing footprint decals or playing step sounds then I would consider that a bug, perhaps someone can log it ^_^
#10
05/05/2009 (10:15 pm)
@James Ford: I dont know if it is a bug yet, i have not tested that feature. But will be sure to report it once i do test it and if it is a bug....
#11
It gives you DX Version error before compiling the smRenderData.materialIndex, thats why it "appears" to compile fine.
Its definiatly not in, sadly :)
PS, did a bug report on it now, its definiatly a bug.
Im so happy on not on the T3D bug fix team (lo), i mean wow they got to get busy to fix all the bugs posted, found, not found, bad/unused code, ect ect ect..
Can it even be done you think ? in the 1-2 month they "said" :o
05/06/2009 (3:13 am)
@CayloIt gives you DX Version error before compiling the smRenderData.materialIndex, thats why it "appears" to compile fine.
Error 1 error C2039: 'smRenderData' : is not a member of 'TSShapeInstance' j:CPlusPlus LibrarysTorque 3D 2009 Beta 1EnginesourcetstsCollision.cpp 1091 Torque3D Error 2 error C2065: 'smRenderData' : undeclared identifier j:CPlusPlus LibrarysTorque 3D 2009 Beta 1EnginesourcetstsCollision.cpp 1091 Torque3D Error 3 error C2228: left of '.materialIndex' must have class/struct/union j:CPlusPlus LibrarysTorque 3D 2009 Beta 1EnginesourcetstsCollision.cpp 1091 Torque3D
Its definiatly not in, sadly :)
PS, did a bug report on it now, its definiatly a bug.
Im so happy on not on the T3D bug fix team (lo), i mean wow they got to get busy to fix all the bugs posted, found, not found, bad/unused code, ect ect ect..
Can it even be done you think ? in the 1-2 month they "said" :o
#12
I didnt get that error output. Just the one line about DX version, how disappointingly deceiving(is not all deception disappointing?).
Ok... Now its spitting them at me(errors, im talking about not insults), after a retry at compiling.
And sure enough, there is nothing comparable to TSShapeInstance::smRenderData.materialIndex , that i can find. What a haggelfish! I am not a happy flu victim.(dont worry its not that pig flu. unless one never hear from me again- you may only wish,but most of my assumptions seem to be wrong today)
EDIT: Ya it can be done. I have seen amazing things at the fingers of fewer programmers, in similar amounts of time. It depends on the amount they get paid... $ = motivation in most circles.
05/06/2009 (4:51 am)
What the heck? I didnt get that error output. Just the one line about DX version, how disappointingly deceiving(is not all deception disappointing?).
Ok... Now its spitting them at me(errors, im talking about not insults), after a retry at compiling.
And sure enough, there is nothing comparable to TSShapeInstance::smRenderData.materialIndex , that i can find. What a haggelfish! I am not a happy flu victim.(dont worry its not that pig flu. unless one never hear from me again- you may only wish,but most of my assumptions seem to be wrong today)
EDIT: Ya it can be done. I have seen amazing things at the fingers of fewer programmers, in similar amounts of time. It depends on the amount they get paid... $ = motivation in most circles.
Torque 3D Owner Bo Bjering
/slap me silly