Overlay Scene

My character moves with “click and move”.
When i use overlay scene as inventory and click on sword to equip then character moves where i clicked.
How can i do so that if mouse is on overlay scene area then the click works only there and if it is out of the area then it works as “click and move”

Does it not work in the overlay scene?


You need to have the mouse over sensor in the overlay scene.

Yes it works, it does both, moves character and equips. I have mouse over sensor in overlay scene.

Is your problem solved then?


Then can you please clarify your problem?


I have Main Scene. In game i press “i” for inventory (Overlay Scene). When i press ex. on sword that i want to equip then it equips it (good), but also moves my character in Main Scene where i just clicked in inventory (bad), because i have “Click and Move” system for character. (character moves where i click on ground)
The “click” on Overlay Scene works and also goes through on ground. Problem: How to stop it going through the Overlay Scene Inventory onto the ground … ?

You could suspend the main scene by using the Scene>Suspend Scene actuator.


Thanks for reply, but suspending the Main Scene is not the best solution, it ruins the game experience. Also character should be able to move when inventory is opened, but only by clicking on ground.

You could put a mouse over sensor on the ground so the mouse has to be over the ground and clicking for the character to move. This way, when the cursor was over the inventory, the mouse wouldn’t be over the ground, so even if you clicked, it wouldn’t activate moving the character.

Python script works as you said Wehrdo, but only in Main Scene. The problem is with Overlay Scene, mouse won’t detect it as solid or something so the click goes through on ground.

Be sure it’s set to “mouse over” and not “mouse over any”. It’s probably set right, but just to be sure. :slight_smile:

That won’t work, because it goes though the Overlay Scene… …on ground. (means its “mouse over” the ground)

Hmm… Do you think you could upload an example .blend? This way we could troubleshoot your problem directly, without having to go through you every time. Just append the parts that aren’t working to a different blend, and pack any necessary textures if you don’t want to share your entire game.

Here simple .blend : pathfinder.blend (158 KB)

“Space” for Overlay Scene.
The “click” on Overlay Scene works and also goes through on ground. Problem: How to stop it going through the Overlay Scene onto the ground … ?

It can be python problem, I’m not that experienced with python yet.

This really had me stumped. This was the best I could do. Instead of putting the inventory on a different scene, it just puts it on a different layer, because that way the ray won’t go through it.

The things I changed were:
– Put the two inventory buttons on the second layer of the same scene
– Parented the close inventory button to the main inventory, so the buttons wouldn’t be added in the exact same spot and have Z-fighting.
– Added an empty in front of the camera that adds the inventory when the space is pressed, and parented that empty to camera.
– Moved the Mouse Over Any sensor and the Left Click sensor from the target cube to the ground
– Changed the mouse over any sensor to a “mouse over”, because it was on the ground
– In the mouse script, I changed where it said

if left.isPositive():


if left.isPositive() and target == getobj["Plane"]:

That way, it checks that you’re clicking on the ground and not the inventory or something else.

– Selected the “TAP” option on the Mouse Left Click sensors on the ground and the inventory, so when you close the inventory, that click doesn’t carry over to the ground and move the character.

– Made the materials on the inventory shadeless, because the lighting wasn’t working well for them, and I didn’t want to change the lighting.

I think this is all I changed. If anything else is different, then I probably changed it lol. Sorry this took so long to reply to, but it took me awhile to figure out.

Also, are you using Blender 2.49? Because if you’re are, you’ve got several things in your script that are depreciated and should be updated for 2.49.


pathfinder.blend (163 KB)

Thanks, Wehrdo.
Your solution works well and is easy to change.
That .blend was just fast sample of my problem, but can you tell me more about the script updating, because my game resources start from Blender 2.37.


It is possible to use an overlay scene. I have done this same thing in a previous project. An example .blend file is attached demonstrating the technique I used.

In the file, the cube spins when clicked. Every object in the inventory has a script which toggles a global boolean telling the game the mouse is over the inventory. All scripts check this global value before running actions (in this case, spinning the cube).


mouseInventory_249b.blend (40.3 KB)

Every time they update the Blender Python API, they change some things. At least in the game engine, they allow the previous version’s functions, classes etc. to work, but it puts an error in the console that tells you it is deprecated. If it is deprecated, that means the next version won’t support that function.

If you keep everything up to date for the current version of Blender, you can test your file on the next version of Blender and it will work, it will just throw deprecation warnings at you.

Some parts of your scripts are deprecated in Blender 2.49. If you try to test that in 2.5, it won’t work at all. If everything is kept up to date, you can test them in 2.5 and the console will tell you what you need to change instead of scrounging around in the API.

I hope that made sense :confused: If it doesn’t, just say so.