0
votes

I am working on a Unity 3D game for Oculus and I have problems with making my objects to apply physics on a player. So getting rid of a CharacterController and using something like a rag doll is not an option.

I am using OVRPlayerController, that has a Rigidbody with mass 1 and a box collider on it. My gameObject has a Rigidbody of mass 100, and a box collider. But when the object hits the player it just goes through it, whereas I want it to push the player in x direction.

I tried using onColliderHit but it doesn't even recognize the collision between the player and the object, so I checked box collider on the object to be a trigger and I use OnTriggerEnter() to recognize the collision.

I tried to translate the player's position on collision, but player gets positioned to weird places out of my map for some reason. Here is what I use:

info.transform.Translate(new Vector3( -0.5f, 0.0f, 0.0f));
info.transform.rotation = Quaternion.identity;

I also tried to manually set the x position of the player but this doesn't work, and I know I am not supposed to do it.

I searched for answers for a long long time, so please don't answer to this with something like "oh, have you tried googling it, there are a lot of similar questions" etc.

1

1 Answers

1
votes

It should be detecting the collision just fine, as long as one of the box colliders has a non-kinematic (Is Kinematic = false) rigidbody attached.

Make sure Is Trigger is false, and you specified a material for your collider.

Also try messing with the other properties on the rigidbody, such as Collision Detection and Mass. The unity docs indicate that your mass should be no more or less than 100 times that of other rigidbodies.