Quantcast
Channel: Questions in topic: "charactercollider"
Viewing all articles
Browse latest Browse all 8

ControllerColliderHit, two objects, takes wrong one

$
0
0
I'm using this code to detect the collision between my player and "Cloud" gameObject. Funnily enough this code: function OnControllerColliderHit(hit : ControllerColliderHit) { if (hit.collider.gameObject.name == "Cloud") { print(this.hit.collider.gameObject.name); } } prints "Plane" in the debugger, which is not the behavior I'm looking for. Clearly the Collider must be detecting both the Plane and the Cloud (that cloud is sitting on a plane). How can I make sure that I'm taking the Collider with the Cloud and not the plane. IE: make sure this `hit.collider.transform = Vector3(0,0,0)` would affect the cloud and not the plane.

Viewing all articles
Browse latest Browse all 8

Latest Images

Trending Articles





Latest Images