Dome like camera movement.

Blitz3D Forums/Blitz3D Beginners Area/Dome like camera movement.

SheepOnMintSauce(Posted 2005) [#1]
How would I go about making a camera that could move around an object using the mouse, in a sort of dome like way? Kind of like the way camera moves around the vehicles in Grand Theft Auto:Vice City.

A bit like this, where the green dome shape shows where the camera can rotate.


I understand I'll have to use a pivot, connected to either the object, or the camera, or both! But I've got trouble trying to figure out how to point the camera at the object while it's rotating around the object. Help?! =(


Stevie G(Posted 2005) [#2]
Create a pivot. Parent the camera to the pivot. Offset the camera from the pivot. e.g. positionentity camera,0,50,-100

Then when you use turnentity on the pivot , just pointentity the camera to the truck entity.

Turn the pivot on the yaw axis based on mousexspeed()* ( some small number).

Did that make sense?!

Stevie


SheepOnMintSauce(Posted 2005) [#3]
Yeah, I think I know what you mean. If I was going to be moving the truck around though, would I need to parent the pivot to the truck as well? If that's possible.

Thanks.


puki(Posted 2005) [#4]
Yep


SheepOnMintSauce(Posted 2005) [#5]
Right, I'll give that a shot tomorrow then. Thanks a lot for your help! =)


octothorpe(Posted 2005) [#6]
You only need to PointEntity the camera at the pivot initially; turning the pivot will move the camera, but it will stay pointing at the pivot. Alternately, if you move the camera backwards away from the pivot, it'll already be pointing at the pivot.

Instead of using TurnEntity (rotating something with pitch and yaw enough will eventually produce roll - I'm not sure what the term for this is) consider keeping track of the pitch and yaw yourself and using RotateEntity. To restrict rotation to keep the camera above the vehicle, keep pitch > 0. Also, pitch < 90 to keep the camera from being upside-down!




Ross C(Posted 2005) [#7]
Alternatively:

RotateEntity camera_pivot, EntityPitch(camera_pivot)+MouseYSpeed()*.4, EntityYaw(camera_pivot)+ MouseXSpeed()*.4, EntityRoll(camera_pivot)



Ross C(Posted 2005) [#8]
Sorry, the above doesn't stop the gimbel lock thing.


SheepOnMintSauce(Posted 2005) [#9]
Ah, that's great I'll take a look at that. Thanks.