Movement constraints for kinematic object

What I am working on is a simple Breakout/Arkanoid clone. The issue I am currently facing is in relation to the “Paddle” movement. Through the reading that I have done I have come to the conclusion that I should be implementing the paddle as a kinematic object (please correct me if I am wrong.) At this point I have the paddle working nicely with mouse input but have had no success limiting the range of motion to stay within the playing field. This field is simply a plane surrounded by boxes. What I wish to achieve is that when the paddle encounter one of the boxes that form the left or right sides of the playing field it will simply not move any further.

I think you’re over-complicating things. First of all you don’t need a full blown physics engine to do arkanoid physics and to not move the paddle outside of the screen, simply stop applying the mouse input when its on the side of the screen instead of looking for a way to apply “constraints”.

Thanks for the reply @normen. I understand that I am probably overcomplicating things, but this was sort of deliberate as it is my intention to use this as a bit of a playground for me to experiment with the physics engine in a fairly simple and easily controlled environment. The rest of the physics involved I am fairly confident about as I have discovered a most of what I will need to do for the rest of things while trying to solve this problem. Following your suggestion for the paddle however, what would be the best way to test for the edges? Should I simply test for position using getLocalTranslation() or is there something else I should be looking at?

Ok. Using if((spatial.getLocalTranslation().x > -12.5f)&&(spatial.getLocalTranslation().x < 12.5f)) for my test I am getting the desired movement limitations…Thanks for that advice, I completely overlooked it(overcomplicating things as you said.) The only issue I now have is the paddle getting stuck when it hits those limits. I guess I just need to expand my test to include attempted movement direction. Thanks once again.

After tweaking my logic a bit, works great! Thanks