hey everyone
i have some thing ala this code:
if(input.GetKeyDown(“x”))
{
anim.Play (“grab”);
}
however I wish to only enable it within a certain zone, collider or something. at this point its just playing whenever I play x all over the scene
thanks!
bests
You can create a trigger collider and use OnTriggerStay. Set the collider isTrigger to true. Or you can use a regular collider on the ground and tag it “XZone” or something, and every time you press x you can raycast downwards and if you hit the collider in question do the animation, if not, do nothing. Which option sounds the best to you? I would choose the trigger if I was able to fit the area within a simple box collider, but I would use the later option for a more complicated area mesh wise