Hi,
I’m building a house with several items “hidden” in other objects like drawers.
So a user clicks a drawer, it translates open, then the object in side it visible and the user can take it.
However I am having issues with some objects.
In the screen shot you can see an open drawer with an iPod inside. The drawer only has a Collider on the front. As far as I can see there are no colliders interfering with the collider of the iPod.
I’ve scaled the colliders up a little to make them easier to click on.
I’ve set up a simple script attached to the iPod:
void OnMouseDown(){
if ( Vector3.Distance( transform.position, Player.transform.position ) < distance ){
print"object close enough and clicked. do something";
}
}
Now what happens is:
When I stand (FPC) stand say 1.5m away and I click the drawer, it opens and I can take the iPod without any problem.
When I however stand as close to the drawer as I can, I suddenly can’t click on the iPod anymore. The click is not registered.
Also, I can only click on the “front” side of the collider of the drawer. When I stand close to the iPod I should be able to click on the top or back of the drawer collider but that does not register either.
I can click on a tiny area just below (in the image) the iPod and the drawer, but that’s all.
I do have a Screen.CursorLock = false; Screen.CursorLock = true; in Update() in a script attached to the FPC. When I disable that, I am able to click correctly.
It seems as though the Lockcursor does something to the coordinates?
What am I missing?
Thanks!!
Marco
