Page 1 of 1

Chase camera does not rotate in chase "offset" mode

Posted: Sun Dec 25, 2011 7:48 pm
by jimmyfo
Hi, this is a great tool, but I've run into a really simple issue that I can't find (I've seen a few similar threads here, but nothing specifically addressing this).

Using the standard demo with no changes, when a vehicle is activated with the "V" key, this following line is called in VehicleInput.Activate():

Code: Select all

Camera.ActivateChaseCameraMode(Vehicle.Body, new Vector3(0, .6f, 0), true, 10);
The third argument can be true or false, and it states it changes whether the camera rotates with the object it follows or not, like in Camera.Update():

Code: Select all

                if (transformOffset)
                    offset = Matrix3X3.Transform(offsetFromChaseTarget, entityToChase.BufferedStates.InterpolatedStates.OrientationMatrix);
                else
                    offset = offsetFromChaseTarget;
However, changing that variable doesn't affect the viewing results at all and I've been able to confirm that the orientation matrix does change with the entity followed. Is it supposed to rotate with the entity so that it is always behind/in front of it? The position of the camera changes, but never the rotation, unless the mouse is used.

Thanks,
James

Re: Chase camera does not rotate in chase "offset" mode

Posted: Sun Dec 25, 2011 8:32 pm
by Norbo
The 'offset' being rotated is the offset from the vehicle's center of mass to the look at point of the camera. If transformation is off, then the offset is applied in world space. If it's on, it's applied in vehicle space.

If you would like to have a chase camera which rotates with the car, you may want to control the view matrix directly. The BEPUphysicsDemos systems aren't very flexible since they're designed to run little sample physics engine demos and not much else. If your goal involves substantial modifications, it's probably easier to just to write it from scratch.

Re: Chase camera does not rotate in chase "offset" mode

Posted: Sun Dec 25, 2011 8:43 pm
by jimmyfo
Ah, gotcha - I wasn't sure what was going on there. So if I wanted to get values about the entity location and rotation, I would look at entityToChase.WorldTransform? Do entityToChase.Position and entityToChase.Orientation contain the same information?

Thanks!

Re: Chase camera does not rotate in chase "offset" mode

Posted: Sun Dec 25, 2011 8:48 pm
by Norbo
So if I wanted to get values about the entity location and rotation, I would look at entityToChase.WorldTransform? Do entityToChase.Position and entityToChase.Orientation contain the same information?
Yup and yup. WorldTransform is just a convenient Matrix format representation of the core Position and Orientation properties.

Merry New Yuletide Christholidaymas!

Re: Chase camera does not rotate in chase "offset" mode

Posted: Sun Dec 25, 2011 9:03 pm
by jimmyfo
Same to you, thanks!