Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

In my setup there is a box with a hole on one side, and a freely movable "stick" (or bar, tube). This stick can be inserted/moved through the hole into the box. This hole is exactly as wide as the diameter of the stick.

In reality, when you would now hold the end of the stick in your hand and move the hand left/right or up/down, the other end of the stick, which is inside the box, would move into the opposite direction of your hand movement (because the stick is affixed at the pivot point where it is entering the box through the hole).

(I hope you understand what I mean so far.)

Now I need to simulate such a setup in a 3d program. I have already successfully developed an Ogre3d framework for this application, including bullet. But what I don't know is how I can implement in my program what I have described above. This application must include two more features:

  1. The scene camera is attached to the end of the stick that is inserted into the box. So when the user would move the mouse (to control "his" end of the stick outside the box), then the camera attached to the stick would move in the opposite direction, as described above.

  2. The stick has some length, and the user can push it further into the box, or pull it closer to him again. That means of course that the max. radius on which the end of the stick inside the box can move depends on how far the stick is pushed into the box. Thus, the more the stick is pushed into the box, the larger the max. radius of this end of the stick with the camera will be.

I understand this is maybe quite a complex thing, so I don't expect any real source code here. I already have the Ogre and bullet part as said up and running, as well as a camera attached to the stick. This works fine. What I don't know though is how I can simulate the setup described above. Especially the requirement that the stick is affixed at the position of the hole on the box, where it is inserted into the box.

Any ideas how I could approach to implement the described setup?

share|improve this question
1  
Wouldn't this be simple if you just rotate around the pivot point of the stick? Maybe you can draw a picture to illustrate the problem. –  Byte56 Apr 26 '13 at 16:52
    
@Byte56: Yes exactly, I am talking about this pivot point (sorry English is not my first language). But how can I rotate the stick around this pivot point? How can I tell Ogre/bullet to not move the whole stick, but the tip of it based on the tip's distance to this pivot point? –  Matthias Apr 26 '13 at 17:15
    
    
Can sombody please explain to me why this question has been down voted? –  Matthias Apr 28 '13 at 17:19
2  
I'm not really sure what you want to do, but it sounds like what you are looking for is constraints –  msell Apr 30 '13 at 5:20

1 Answer 1

Have you considered building a set of animations that go from rest post (stick with no interaction applied) to end poses (we need a picture to really get what you're talking about) and blending the animation(s) based on user input?

I may not understand the extent of your interactivity, or needs.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.