Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - JonnyDee

#1
Support / Orbiting camera
August 28, 2003, 05:36:22 AM
Got it!  Looks like a serious misunderstanding on my part of the difference between objectspace and worldspace  :oops:...  Using your example as a starting point i've now got the behaviour I was after, thanks for the help and the library update.
#2
Support / Orbiting camera
August 27, 2003, 03:38:31 AM
Hmmm - i've had a further look at it, and I can't work out why the camera should be moving in an ellipse.  Also, the player doesn't rotate, unless I remove the cameraHolder rotation.  If I remove that line, the player rotates correctly, but obviously then the camera doesn't!  I'm wondering if this is related to the way i'm setting the rotation pivot? I tried setting it to player.getYAxis(), but then the camera doesn't rotate at all.  I have posted my code below in case i'm being an idiot, (very likely  :D )

playerRotation = xDif * rotationMultiplier;

// Rotate the player and cameraHolder
cameraHolder.setRotationPivot(player.getTransformedCenter());
player.rotateY((float)Math.toRadians(playerRotation));
cameraHolder.rotateY((float)Math.toRadians(playerRotation));

// Move the camera back to the cameraHolder and look at the player
theWorld.getCamera().setPosition(               cameraHolder.getTransformedCenter());
theWorld.getCamera().lookAt(player.getTransformedCenter());
#3
Support / Orbiting camera
August 27, 2003, 01:45:09 AM
Thanks for the new version - getTransformedCenter() now works a treat!  For some reason my camera is moving in an elliptical path, rather than a circle as I intended, but I think that is my code  :D.
#4
Support / Orbiting camera
August 26, 2003, 09:06:17 AM
Thanks for the speedy reply!  As soon as the feature is available, i'm happy to be the beta tester  :D .  An easy way to place the camera using a helper method would be excellent and just what i'm looking for - looking forward to the new version!

Cheers,

Jon
#5
Support / Orbiting camera
August 26, 2003, 05:20:15 AM
Hi,

I am currently trying to figure out how to rotate the camera around an object.  The effect i'm looking for is for the player object to always be maintained in the center of the view, whilst the camera orbits around the player and the player rotates so the camera is always looking at the same side of the player.  I have tried to use a dummy object which rotates around the player to give the coords to move the camera to, like this:

playerRotation = (float)(xDif * rotationMultiplier);

// Rotate the player and cameraHolder
cameraHolder.setRotationPivot(new SimpleVector(sphereX, sphereY, sphereZ));
sphere.rotateY((float)Math.toRadians(playerRotation));
cameraHolder.rotateY((float)Math.toRadians(playerRotation));

cameraX = cameraHolder.getCenter().x;
cameraY = cameraHolder.getCenter().y;
cameraZ = cameraHolder.getCenter().z;

// Move the camera back to the cameraHolder and look at the player
theWorld.getCamera().setPosition(
 new SimpleVector(
   cameraX,
   cameraY,
   cameraZ));
theWorld.getCamera().lookAt(new SimpleVector(sphereX, sphereY, sphereZ));

Whilst debugging this code, i've found that cameraX, Y and Z don't change from the initial values.  I can see the player rotating and if I use align to align the camera to the player, the camera rotates when I move the mouse, as it should, but I can no longer see the player!  Am I using getCenter() incorrectly?  I tried using calcCenter() before getting the cameraHolder center to reset the camera position, but this sets cameraX, Y and Z to NaN.

Any help would be appriciated!

Thanks,

Jon