- Home /
Player Ship Collisions
Hi,
I was wondering if in UnityScript, there is a way to tell if an object is touching another object. Also, is there a way to say, if that is true, you can't move. I'm making a mine lander style game, so I need to know when my ship is touching another collision mesh.
Thank You,
koramere
Answer by whydoidoit · Jun 15, 2012 at 03:57 PM
It sounds like you want to be using the physics which will handle a lot of this stuff for you!
If you have a rigidbody and a collider attached to your surface and your space ship then it will stop the ship from going through the surface: you can also detect a collision by writing a function OnCollisionEnter(collision : Collision)
Sorry. I'm yet new to scripting, because I'm nativly an artist, but am trying to freelance. Could You or someone else explain what you just said?
Also, I need it to stop transforms that I currently have
I $$anonymous$$ean by that: If the player is giving input that would make transforms, they will stop when it collides
So do you have a rigidbody and a collider attached to the surface of the moon and to the ship? Component->Physics menu in Unity.
I have a Collision mesh, which is the child of my player Ship. I also have a rigid body on the collision mesh. How do I find out when It is colliding with something else, and if so, how do I stop it from moving?