- Home /
How do I get the collider working when I do transform.
For the game I am creating I have made a cloud system that will move the clouds across the screen (using transform.Translate(0, -0.5, 0); in update. This part of my script works however I have also included a huge box collider with trigger applied at the edge of the world and included in the script a collider that when the object hits the collider it'll be moved by 0, 300, 0, basically in an attempt to loop the cloud so its constantly moving in one direction but comes back around. However this doesn't work and the object goes straight through the collider. The collider works because I've applied the script (apart from the update constant moving part) to my fpc and it teleports me backwards, its just the cloud that isn't working. I have tried using different colliders on my cloud as I read somewhere that mesh colliders don't work on moving objects but none of the colliders work, any help please.
Answer by TanselAltinel · May 10, 2018 at 09:24 AM
When you are moving objects with colliders, you need to add RigidBody component to one of them in order for them to be able to fire collision events.
Also, it is not good practice to move objects with updating transform values if they are colliders, as this will confuse the physics engine.