- Home /
Question by
Shani Awan · Feb 08, 2013 at 07:36 AM ·
javascriptmovementcollisiondetection
Movment of character through Java script
I have created two simple animation and apply simple capsule collider having fricitionless material.Now when these meshes collide with each other then a function called and its give me a message on the console that a mesh collision is occur.but when collsion occur the player will not move just like realistic human being.So how can i move a player when second player hit it..I have written this code for collision detection
function OnCollisionEnter(Bam : Collision) { if(Bam.collider.gameObject.name == "cube") { print("cube collision"); } if(Bam.collider.gameObject.name=="Terrain") { print("wall collision"); } if(Bam.collider.gameObject.name=="simple_anim") { print("with the mesh"); } }
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613092337im_/https://answers.unity.com/themes/thub/images/avi.jpg)