Left mouse click on object A to rotate object B?

Hello,

I’m not sure how to solve a problem I have, I’m quite new to BGE with its bullet physics and Python. The problem I have is that I want object A to always rotate around the Z-axis when I left-mouse-click on object B, and I want the rotation to stop when I mouse click a second time on object B.

Object B is a button and object A is a cylinder.

Any help is appreciated!

First of all, to trigger animation of B by clicking on A, you will have to send a message to B from A,by adding a message actuator to A and then a message sensor to B.

So, when B will sense a specific message like “click” ,animation will start.

Now, as you want to switch the animation on alternate clicks, you will have to add a Boolean property to A .

This can be toggled by adding a property actuator to a.

now just send 2 messages to B like “start and stop” on true and false values of Boolean property.

If you still face any problem send me your mail ID , so i can send you a demo file .