- Home /
Strange collision problem with block and terrain
Hey folks.
I have blocks falling from the sky onto some terrain. The blocks are tagged "Block" and the terrain is tagged "Ground".
The block has the following code attached to it:
I have another piece of code elsewhere which basically does the same thing but increases the width - and this is working perfectly, i.e makes the progress bar grow. The idea of this code is - when the block touches the ground - the progress bar should shrink.
2 questions:
1/I would expect the collision to be tagged as "Ground" - yet it is always tagged "Block" when the block hits the ground - remembering that this script is attached to the Block itself, this seems odd.
2/The progress bar does not shrink...
Please help!
The pastebin has expired so here it is again : http://pastebin.com/U$$anonymous$$xJWieW
I don't really get it, if the script is attached to the block why are you checking if it collides with "Block" -if(col.gameObject.tag == "Block")-?
Thats the whole question...i should be checking against "Ground" not "Block" , but for some "Ground" check never fires and the check with "Block" fires when it hits the ground...additionally the bar does not retract.
Answer by Renegadeandy · Mar 13, 2012 at 12:15 AM
I have no idea what the problem was - but after a bit of debugging i solved it by retagging both block and terrain :)
Your answer
Follow this Question
Related Questions
Massive framerate fall with Character Joint 0 Answers
conversion of script guitexture to cube or other primitive (iphone) 2 Answers
HUD on Android/iPhone : GUITexture or OnGUI (drawTexture) ? 2 Answers
[Question Duplicated] conversion of script guitexture to cube or other primitive (iphone) 0 Answers
Deploying to Android or iPhone device - track public variables in inspector? 1 Answer