Author Topic: camera roll from object  (Read 712 times)

Offline dutch_delight

  • int
  • **
  • Posts: 58
    • View Profile
camera roll from object
« on: April 05, 2013, 01:12:05 am »
Hi all,

I've got a little problem with my camera and not sure how to fix it.

What I have is a car that is rotated by a dummy. the car body is a child of this dummy.
I then have an extra camera dummy that is attached to the rotation dummy. My camera uses that position.


Code: [Select]

controls_camera = world.getCamera();
controls_camera.align(playerMoveDummy);
controls_camera.rotateY((float) Math.PI);

tempVector = carCameraDummy.getTransformedCenter();
controls_camera.setPosition(tempVector);


But what happens is shown in the image below:  (front view of car)
http://www.richterdesigns.co.uk/stuff/camera_align.jpg

Image A is the setup: camera above the car.
Image B is what happens when my car rotates.
Image C is what I want to happen.

Does anyone know how to do that or point me in the right direction? I assume I need to get matrix from the dummy and apply it to the camera?