Game Development Community

T3DCameraComponent (SetTransform) need help

by Jeremy Lim · in Torque X 2D · 07/25/2008 (2:25 pm) · 2 replies

Hi! anyone knows how SetTransform in the T3dcameracomponent works? Whatever matrix i plug in, its all messed up. ive tried translation, matrix.createlookat and even identity, the camera just appears messed up. I dont think i know how SetTransform works and what iam trying to acheive is to fixate my interpolating camera behind my vehicle and right smack in the middle of the screen while its making a turn, using RotatedPositionOffset just doesnt cut it and cos it shifts my vehicle off the center. I need something flexible like a lookat matrix! Iam such a noob, pls help! thanks!!

About the author

Recent Threads

  • Units used?

  • #1
    07/30/2008 (9:46 am)
    I had to add a new public method to the camera class (which will be in the next Torque X release). If you have a pro license, you can give this a try....

    public void SetTransform(Matrix NewTransform, bool UpdateTransform)
            {
                _transform = NewTransform;
    
                if (UpdateTransform)
                    _UpdateTransform();
            }

    If you do not have the pro license, maybe you can add this to a sub-class. I haven't tried this, but you can try it out ;)

    1. Create a new file named MyCameraComponent.cs
    2. Declare something like this...
    public class MyCameraComponent : T3DCameraComponent
    {
    }
    3. Add the method above to this class
    4. Replace your games use of the T3DCameraComponent with MyCameraComponent and call this public method.

    I think that this should work too, I just don't have time to try it out for you first. But maybe you can try it and report back what happens.

    John K.
    #2
    07/30/2008 (12:39 pm)
    Thanks for the reply John! youre nice!
    i tried adding the method to a subclass, but still it gives me the same bad results. Btw it says my subclass hides iherited member, iam not sure if thats the problem, but Iam using Matrix.Identity for NewTransform, which is the initialized value for _transform, but it still doesnt work...guess I'll just wait and get my hands on a pro version once the next release is out. Thanks for all the hardwork John!! Cheers!!!;)