- Home /
Block Touch
Hello, I need some help..I'm making an app that display model, attach and detach the part of the model to show to people. For example, a car, the tyre of the car detach from it and shows explanation of it. So now, I need a function where when one part of the model is detaching from the model, it will not allow me to detach another part until the 1st one to detach reaches the destination. Something like it doesn't allow user to touch any other part until it fully detach. Anyone can help? :(
Answer by farmerdwight · Jun 12, 2020 at 08:34 AM
Sounds like the behavior you want is for collisions to initially be allowed for every part of the car. But when a part is selected, that part is now in focus and all the other collisions are turned off. There are several ways you could disable collisions. You could set the layer of each part to be on a different "noCollisions" layer. You could disable the collider component on each component. You could set some boolean "isPartSelected" and each part's "OnCollisionEnter" first checks that bool before become activated.
Yea sort of like that, is there any way other than using "OnCollisionEnter"? Like maybe disable the touch input or something.
Yes, depending on how you are providing input (mouse, touch?), you should be able to disable the source of input such as disabling the raycast that is being emitted or disabling whatever function that is checking for input.
Okay, I'll see what I can do. But i have to disable the raycast for awhile right? Ins$$anonymous$$d of fully disable it.