Author Topic: free camera  (Read 2289 times)

Offline drounal

  • byte
  • *
  • Posts: 16
    • View Profile
free camera
« on: May 15, 2006, 09:04:22 pm »
Hi everyone !

I'm a total beginner trying to make a video game using jpct. I used the sources of the examples to help me out and, so far, it works fine. but a problem raised with the camera.

In the "car" example, the camera is attached to the car: I want to set it free. For the moment, I removed the movement but I can't manage to make it move using the keyboard. Each movement done pressing a given key, is undone when releasing the key ...

Has anyone got a model or any hint ?
thx
Louis

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
free camera
« Reply #1 on: May 16, 2006, 05:24:10 pm »
The camera itself is quite simple to use. Just get it from the world and call the moveCamera-methods with the movement constants needed for the desired direction. The car example does a bit more to keep the camera following the car and obviously, you've removed just one part of this code but not the complete code, so that somewhere the camera is still set to...whatever. Maybe the fps-example is close to what you are looking for.

Offline Melssj5

  • double
  • *****
  • Posts: 715
    • View Profile
free camera
« Reply #2 on: May 16, 2006, 07:48:28 pm »
Look at the fps example. There you move the camera using the keyboard.

The camera can be moved using the MoveCamera methods, you just need to give a direction and a speed. place the method on the event you need. Its better to use the KeyMapper than the normal java events.
Nada por ahora

Offline drounal

  • byte
  • *
  • Posts: 16
    • View Profile
free camera
« Reply #3 on: May 16, 2006, 08:54:37 pm »
thx, it works fine !
++