Make parent problem

I have a button which is parent to a host of buttons (Main >> host_of_buttons) such that when main is clicked, the host of buttons appear (drop-down menu)
however, in my file, i also have a mouselook implementation. since i do not want the main button to move around when i move the mouse, i made camera as parent of the main (camera>Main)
but then what happens is the host_of_buttons move around during mouselook. how do i solve this problem

Thats a bit unclear. Would it be possible for you to upload your blend some where so that we can take a look?

Some website like PasteAll.org.

-Sunjay03

I aggree with Sunjay your description is a bit confusing.
It sounds like you have some object scaling on the parents. Get rid of that.

The best way for menus or buttons is to have them in an overlay scene.
This has some benefits:

  • If you move the camera of the main scene, the menu stays on screen.
  • No object of the main screen will ever hide your menu.
  • You can move the overlay camera to show different menu content (or move the content to the camera.
  • You can reuse the same overlay scene with other main scenes (levels).

Sorry for the poor description! Here’s what I mean to say:

Mesh features is a drop-down button and a parent to its children buttons (Add, Delete, Optimize, Make Dragable). However, Mesh Features is itself a child of parent Camera (just like the buttons Restart, Save, Load). Camera is a child of parent explorer, which is used for mouselook implementation. Because of this, when I move the camera (Press P and move mouse), the Mesh Features, Save, Restart etc buttons move with the camera giving the appearance that they are not moving at all. However, if you press Space (to get out of mouselook) and click the Mesh Features button, its children have actually moved around.

I tried the possibility of Overlay scene for the buttons, however, the buttons such as Make Dragable and Delete do not seem to work, because they have mouse sensors that use hitob to make an object dragable or delete it. So my guess is they cannot find a hitob because the objects are in another scene.

Please help!

Attachments

problem.blend (624 KB)

Your blend looks like the one from Stralen. Are you working together?

Your problem is due to the fact that mf_button has a scale. Apply the scale <ctrl><a> and it will be fine.

Now some critic:
I think the problem with the overlay scene is that your functions are not encapsulated (is this the right word?). I mean you should form function blocks that makes it easy to replace them or to use them somewhere else. In other words independent.
Example:
The question is: What should happen when I click on the “Make Dragable” button?

I guess: The next object clicked should get a flag dragable or something like that.

  • Function one: Process clicking the button is one function.
  • Function two: Process clicking another object making it dragable is another function.
    There is no need to mix that.
    To communicate to eachother you need an interface. The interface between both blocks could be a message (works between scenes!), or a property (somewhere), or something else.

Example:

  • Function one: When you click the button (in the overlay scene) the button sends a message “make dragging” to a control object (in the main scene).
  • Function two: When the control object receives a message “make dragging” it switches to “make dragging mode”. When in “make dragging mode” it performs the “make dragging” and switches to “wait message” mode.
    This allows to have the button in one scene and the control object in another.

Imagine, you want to extent this by a keypress “M”:

  • Function oneA: Setup another object in any scene listening to keypress “M”. When triggered it sends the message “make dragging” to the control object.
    -> no need to change anything on the second function block.

Remarks:

  • Please provide a short guidance how to use your blend file. I know Stralens previuos files. So I already know to:
    [LIST]
  • press <space> to go into “navigation” mode.
  • click on the “Mesh Features” button to make the submenu visible
  • press <space> again to go into “explore” mode
  • move the mouse to show your problem

[/LIST]

  • Please name your sensors
  • Please name at least your python controllers (just <ctrl><c> the scitp name and <ctrl><v> to the controller name)
  • Please name your actatuators
  • Please do not use variable names like h, gt, c or li. Except you are a genius that can remember the meaning of “h” in a script with 500 lines of code after 6 months not looking into it.
    I hope it helps

That makes me realise what an art programming is :slight_smile:
Yes, we are working together. The thing is since we’re on a deadline, the cleaning up process will have to be done later. The file’s a complex tangle. But with 24 hrs to go it abt ‘it all just works now’. We’ll sit and redo it after tomorrow though.

Here are a few other problems (The file is just as complex):

  1. Since the cam is parented to the planes that form the buttons, the mouselook gives a very weird ‘inverted’ control feel to the mouse. The type where in games you move the controller down to look up. Its understandable that it happens, but it dosent feel very intuitive.

  2. Make dragable dosent work without importing mousetools first. It kinda works fine sometimes and then dosent work fine.

How do I go about this?

Note: 1. Since drag on z is not yet resolved, we discovered a cheat by keeping the cam on the z top looking down. It seems to work even though it shouldnt work on paper because depth and height cannot be differentiated in perspective mode.

  1. INFO: Import mousetools is for importing the mouselook and movement properties that allows you to explore the scene
    Mesh properties is self explanatory. To shift between exploring with WASD and drag mode, spacebar is used as a togle.

Attachments

problem-3.blend (712 KB)

Hey thanks for the prompt reply! Yes, Stralen, shobit and me are working together on this project. Thanks very much for the detailed remarks/critique! but as Stralen said because our deadline is tomorrow, we’re just not worrying about the mess!

CTRL+A worked perfectly! Now everything moves with the camera so they appear stable. Sorted! We’ll work on overlay and message-sending later. We just need a working demo now!

The biggest problem now is the ‘optimize’ button! I still do not know if I can use the ‘Poly Reducer’ script which optimizes the ‘active object’ from Blender, and modify the script to optimize the ‘hitob’ from the game engine.

What would you suggest for run-time optimization? I guess some kind of cheating would be required (such as i used optimize + restart actuator to see the optimized mesh in the ge) because 2.49 does not allow dynamic loading.

Thank you very much again for the help!

I do not think that I can help you with the poly reducer.
But with the Z axis… I will write this into the thread.

Hi Monster,
A lot of time has passed since we completed our ‘messy’ project, and we felt the need to clean it up a little bit!

Thank you very much for the critique. Although I have fully understood the theoretical part of it, I am still not sure how to implement it actually in Blender except only how to make the buttons in an overlay and make it appear in another scene. I know how to make “function blocks” but I am not sure about “message sending” between objects? If I use Message Actuators, how do I send complicated programming lines (the demos I have come across only send simple increment statements such as score=score+1) If you could give me a small demo, it would really really help a lot!

When to use
Messages are quite handy if you want to inform other objects that something happened. Espacially if the object does not care what the receipients are. If no one is listen, it does not matter. If 100 objects are listening, it is fine as well.
(Sending messages to a specific object is possible, but does not have that much benefits, as you can set properties at this object already, even if the object is at an overlay scene.)

Simple Message
For Example:
you have an playground with a lot of coins. If an coin disappears (for whatever reason) you want a counter to increase (or decrease) its value, a sound to play, an animation to start.

How do do this:
When the coin trigger the endObject actuator (for whatever reason), an message actuator sends a message (to all objects).
The counter’s message sensor triggers True because it receives a message.

Do you need to validate the message? No.
Just the fact that a message is received is an information.
In this case it means a message actuator sent a message as we only have this at the coins you can assume the coin does not exist anymore.

Here you see this work for equal message types only.

Message Types (Filtered messages)
To provide different message types you can set up a subject.

For Example:
The same playground, but this time the coins have different values e.g. 1, 10, 100. There is an NPC if it collide with a you a different sound should appear, a text should be displayed, an animation should be played.

Now we need different event types we want to distribute to different objects.
coin 1 disappeared
coin 10 disappeared
coint 100 disappeared
NPC collision
For each event type we set up an Subject at the message actuator:
“coin1”,“coin10”,“coin100”,“NPCcollision”
Each object that should react on the message gets the subject as a filter.

Despite the fact that each object receives the messages, the sensor filters by subject. That means if a “coin1” message is send at the same time. The “coin10” sensor does not recognise the messages.

Each message has this information:

  • something happened
  • and what happened (a conclusion of when this kind of message is send)

All of these can be achived just by logic bricks.

Providing more data/dealing with multiple messages at the same time

The weakness of logicbricks is that the can only deal with True/False data. There is no way to deal with other data without using a Python script or module.

Beside the “filterable” subject the messages can carry a body with string information. It is possible to fill the body with a property value by the message actuator. But … the sensor can extract and provide this information. So you need a script to read the body from script.
That bodies are string is not that bad, as long as you can convert the object to string and back (str() + eval() ).

For example:
The same playground as before, but the coins should have any random value. There are multiple NPC. If they collide with the player a text should display its name etc…

Now you could set up a subject for all possible situation. But this is a “bit” overhead.
So give each coin a property. The value might be set by an random actuator. The message should get the subject “coin” to be filtered. But the message should contain the value of the coin property. This is easy by using the appropriate setup of the message actuator.
You can do a similar thing with the NPC, just that the NPC properties are string with names.

The listening objects, now need to connect the message sensors to a script to deal with the information of the bodies e.g. read the coin value and add the value to a sum. Here you can see the API of the Message Sensor.

You also need to keep in mind if a sensor receives 2 (filtered) messages at the same time, the sensor still fires one pulse. With pure logic bricks this will make the logic miss a message, because it got 2 but act like it got 1.

With a script you avoid such problems:


messageSensor = cont.sensors["myMessageSensor"]
for body in messageSensor.bodies:
  #code that deals with one body. here an example
  cont.owner["sum"] = cont.owner["sum"] + eval(body)

I hope it helps.

Another hint: The message sensor is one of the few sensors wher I recommend always to enable TRUE Pulse mode. Otherwise it would not fire if a messages is received, after another one in the previous logic tick. Problems in this area are really difficult to identify.