Struggling with Object movement via keyboard

Johannes
2011-06-23
2013-03-15
  • Johannes
    Johannes
    2011-06-23

    Good day

    I am playing little with glScene trying to move a cube around with the keyboard arrow buttons.
    If the camera is on the dummy cube then it is not a problem really but when I set the camera on the active cube then I
    dont really understand what I can use to work out on what Axis I must for example if the camera is behind the cube. I made a demo app to show what I mean.

    www.dominion-it.co.za/lazarus/eertecube.zip

    Basically the camera and cube's properties stay the same except for the position ones that I change. Thus I cannot work out for example that the camera is not left from the cube but exactly behind it, thus up will be movement on the X axis for example.

    Hope I make sense.

    thanks

    Johannes

     
  • Johannes
    Johannes
    2011-06-23

    Hi there, I updated the zip file with some extra stuff.
    I might be able to look at trying to use

    GLCamera1.AbsoluteVectorToTarget

    But one thing that also confuses me is if I rotate the object for example then it still goes on the virtual Axes and not on its own
    axes as displayed by its ShowAxis property. Basically it seems although I rotate it the basic axis is still in effect.

    Any idea / direction will help\

    thanks

     
  • Johannes
    Johannes
    2011-06-23

    Okay, think I have got it, use Turn for left right and Move for forward backwards, will play to get more accurate, but it will work
    will update my demo code with this added if somebody maybe wants to see in future when I am done
    tx