0

I'm making a game in Java 3D where I'd like to use multiple behaviors, but I'm having some trouble. This is how it's supposed to work:

The user controls a ball by using the left, right, and up-keys. When the user presses left or right, a custom behavior that controls the View Transformgroup rotates the view in a "third-person view"-fashion. Another custom behavior controls the Transformgroup for the ball (Sphere) when the user hits the up-key. The behavior translates the ball forward according to which axis it's pointed at.

My problem is that I can't seem to get "focus" from both behaviors at the same time. Is there a capability I'm missing?

I'll follow up with the code later if needed.

1 Answers1

1

I'm not sure whether multiple behaviors can have the "focus" since they potentially could listen for the same keys. There might be a way though.

As an alternative you could create a "chain" behavior that actually has the focus and routes the input to the nested behaviors that listen for them.

Thomas
  • 87,414
  • 12
  • 119
  • 157
  • @Andreas Nesheim [please read this thread](http://stackoverflow.com/questions/9976166/java-difference-in-key-detection-between-windows-and-mac) +1 – mKorbel Apr 02 '12 at 13:21