collider not working with transform.translate
i am making a game using first person now i have some buildings in my game and i have added box collider on each building... there is a collider on my first person too and i am using a script in which i am using transform.translate to move my first person... but the problem that i am facing is that my first person is not colliding with the collider of the buildings rather it is passing through the buildings.... need help :(
Answer by Cuttlas-U · Apr 09, 2017 at 04:46 PM
hi; sure they wont work together and it goes through ; the problem is you didn't choose a good function to move the player ;
to move an Object that has Rigidbody component on it u better use other functions like :
GetComponent<Rigidbody>().MovePosition
or like this :
moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
u can also check the Standard Asset unity package there is a good example of this in there ;
Your answer