You are telling the object where to go instead of allowing it to figure out where it needs to go. When you tell it
Transform.position +=…
It tells the object where it needs to be. So even if it collides with something, it can not stop because you are telling it “go here”
If you have a rigidbody and you wish to move it forward, but you want it to stop or bump into things that changes its velocity or direction, you will have to use “AddForce”
You can check the documentation on how to use it but its something like
private var ThisRigid : Rigidbody;
function Start(){
ThisRigid = rigidbody;
}
function Update(){
ThisRigid.AddForce(Vector3.Forward*10*Time.deltaTime);
}
or something liek that, again check the documentation, I am not around Unity.
If you have a character controller you need to use the Move function. in order to have it collide with stuff. Check Character Controller if this is the case.
Thnx Dude, i fixed the problem an hour ago, i used the Move Function, but i marked ur question as a correct question ; cuz its a correct question :)
A simple question, but it has to be asked: do you have colliders on the two objects that you are trying to collide?
– Julien-LyngeWhat @NOAA_Julien asks + does the body you are trying to move have a rigidbody component?
– anon73820239