I am trying to recreate several abilities of the spider-man ps4 game. I already got webswinging done and i am currently trying to do the webzipping. I dont have a problem with the zipping itself it's the edge detection. I've tried several solutions but none has worked. Maybe someone has an idea of how to do it and if possible a snippet of code?
CodePudding user response:
Like edge of a view port or edge of another object if so then use collision detection with colliders
CodePudding user response:
Add colliders to the object you want the web to attach to, and add a collider to the part of the web that hits the object. if you have already done that then maybe the colliders are a bit messed up. Use the OnCollisionEnter3D or OnTriggerEnter3D method to detect collisions. OnCollisionEnter3D checks if the object the script is attached to has touched any collider thats not a trigger and OnTriggerEnter2D checks if it touched any collider thats a trigger
hope this helps!