180 degree rotation in GE problem

I have a rigged character, with several actions. The armature is parented to an empty. The empty is the dynamic actor which holds my sensors and actuators (keypresses, motions, and properties). My armature has a couple action actuators linked to the empty’s keypresses… All of this seems pretty standard from what i have been reading.

My problem is that I want my character to rotate exactly 180 degrees when i press a button. This was the only thing I could find that seemed to address my issue:
http://blenderartists.org/forum/showthread.php?t=54325&highlight=rotate+180

Unfortunately, i can’t seem to get either option to work right…that is

  • dRot = 3.6: I have tried playing with pulses and frame settings, but my character just keeps spinning while the button is pressed.
  • I created an ipo for the empty, where frame 1 is facing one direction and frame 6 is rotated 180 degrees. For some reason, when i press the button to turn the character, the ipo doesn’t play.Does anyone have any suggestions?
    -Brian

There is a bug with the IPO actuator in 2.42. It doesn’t work with dynamic objects.

You could implement a “bouncer” (play rotation IPO on a static object, then have the dynamic object copy the orientation)

Which would look something like this:

STATICOBJ:

keyboard sensor
|
|
V
and controller
|
|
V
ipo actuator

DYNAMICOBJ: (your character)

always sensor
|
|
V
Python controller - in the script input: type “Text” no quotes, case sensitive
Write the following script in the text editor, in the default “TX:Text” file:


cont = GameLogic.getCurrentController()
own = cont.getOwner()
sob = cont.getActuator("act").getOwner()

rot = sob.getOrientation()
own.setOrientation(rot)

|
|
V
Connect to the same ipo actuator from the STATICOBJ that plays the rot IPO. You do that by selecting both the STATICOBJ and DYNAMICOBJ and then in the logic buttons you connect the python controller from the DYNAMICOBJ to the IPO actuator on the STATICOBJ. *Make sure that the IPO actuator is named “act” no quotes.

If your not sure how to do this, just post the .blend, and I’ll do it for you.

Thank you Social,
Your suggestion worked!
A few things for anyone else who comes across this problem:

  • A static object is an actor that is not dynamic
  • Make sure the static object has the same xyz orientation as the dynamic object by showing the xyz axis for both objects
  • My rig uses properties. With the addition of the static object, the properties that dealt with the rotation had to be moved from the dynamic object to the static object. This resulted in a couple more logic brick connections between objects.Have a nice day,
    -Brian