Program Trouble

Hi, I was wondering if anyone could help me with a really weird programming problem I am having. I am trying to make a program to make a character pick up something, then put it down again. I am trying to use steering to accomplish this, but it’s having some really weird effects, and I don’t know why they are happening. I’m not sure how to explain it, so can someone please press e on the attached program to pick up the object, press e again when the animation is done to put it down, then press e to attempt to pick it back up? You will see the program doesn’t work, and not only that, but if you press e once more, then the really weird effects kick in. I’m sorry, but I’m fairly new to blender and I still don’t know how to do a lot of stuff.Experiment.blend (827 KB)

The general idea within your Blend looks good. But you should add some more meaningful names. Properties called “6” or “10” do not really let me guess what you mean.

In my eyes the wired thing is that the pole is flying into his hand. I would expect the character go to it and pick it up where it is.

This requires a sequence or tasks:
A) go to specified location
B) turn into right direction
C) play grab-animation
D) parent pole to hand
C) play the remaining animation to stand again

If you remove the motion actuator from pole it looks much better.

After 5 bows the character is tired. It took me quite a while that “next” is set to 1 rather than 2 whatever that should means. If you use numbers as states you should document somewhere what the numbers mean ;). If you use strings it is much easier to guess. E.g. “bow”,“grab”, “taken”, “free” …

Sorry, I would use more logical names, but I was mostly just getting it to work before I added stuff like that.

The reason it flies into his hand is because this is going to be used in a game, and knowing exactly how much to go forward from any direction while still looking like he is picking it up is beyond my talents right now. I am just starting with a basic program to pick up any object for right now.

Also next is not set to 1, but 0 at start. I switches its number based on the situation. It’s purely a throw away property that is supposed to ensure the correct action is made a the correct time. Why would I use strings? that seems entirely pointless. And what do you mean by what do the numbers mean? They mean nothing.

If you want a more in depth explanation for the purpose of next…
In this program it starts at 0, but when the hand is in the right position it gets a message that switches it to 1. When that happens, if it the pole is not near the hand, it moves to it until it is. When it is near it the number switches to 2 so the movement stops, and it switching to 2 makes it parent itself to the hand and tells the spine to go back up. When I want to place the object down, the spine leans down, and when the hand is in the right position the pole goes away, and it knows to do this because next was set to 2 at the end of the previous sequence. When it is away, it sets next back to 0 and tells everything else to revert back as well. The only problem is everything does not seem to reset, and I have no idea why, like I said before. Help?

[quote=“zachdog6,post:3,topic:559971"”]

Sorry, I would use more logical names, but I was mostly just getting it to work before I added stuff like that.

[/quote]

I mean you already spend a lot of work in this study. But at some point you will not remember what “6” means or is used for. (And it is hard for others to discover that).

[quote=“zachdog6,post:3,topic:559971"”]

what do the numbers mean? They mean nothing

[/quote]

If they mean nothing, you can remove them ;).

[quote=“zachdog6,post:3,topic:559971"”]

Why would I use strings?

[/quote]

I think this is more readable:
“Waiting” = 0
“Moving” = 1
“Gripped” = 2
(finally this are states of an FSM :wink: )

rather then to explain this all the time:

[quote=“zachdog6,post:3,topic:559971"”]

In this program it starts at 0, but when the hand is in the right position it gets a message that switches it to 1. When that happens, if it the pole is not near the hand, it moves to it until it is. When it is near it the number switches to 2 so the movement stops, and it switching to 2 makes it parent itself to the hand and tells the spine to go back up.

[/quote]

I can see this message flow:

come:


ok:

reset:

(format is<subject:<body> )

Listeners to messages are:
Scene Cylinder.001 come
Scene Armature.001 ok
Scene Armature.001 reset
Scene Empty ok
Scene Empty reset

After a few <E> the logic stops sending messages. I guess something went in an unexpected state (more specific - a property gets an unexpected value). You know more about the values than I do.

Have a look at the MessageAnalyzer. It prints messages to console for debugging. This might help you finding out what is going on.