XNA Creators Club Online
Page 1 of 1 (7 items)
Sort Posts: Previous Next

Trying to resize my objects

Last post 10/26/2009 4:47 PM by manswide. 6 replies.
  • 10/26/2009 9:53 AM

    Trying to resize my objects

    Hi, I'm making a little game where the player is transforming 2D-objects into 3D. It sounds simple enough, but I find it very hard.

    I'm using this line of code:

                        effect.World = worldMatrix * transforms[mesh.ParentBone.Index];

    where worlMatrix could be something like (1,000000.1,1) to display a 3D-object as a 2D-object. But this causes the object to automaticly position itself at Z=0.
    Does anyone know how I can resize/transform an object without moving it?

    regardes,
    Måns Wide
  • 10/26/2009 9:59 AM In reply to

    Re: Trying to resize my objects

    I should add this: the worldMatrix is the position of the object multiplied with a scale (and THAT would be something like (1,0000.1,1)).

    worldMatrix = position * Matrix.CreateScale(bX, bY, bZ);


  • 10/26/2009 11:24 AM In reply to

    Re: Trying to resize my objects

    manswide:
    I should add this: the worldMatrix is the position of the object multiplied with a scale (and THAT would be something like (1,0000.1,1)).

    worldMatrix = position * Matrix.CreateScale(bX, bY, bZ);


    Isn't the scale to be done before the translation ?
    Also, isn't "transforms[mesh.ParentBone.Index]" before anything ?
    You speak English, Spanish or French ? You need tutorials in your language ? You can make tutorials in your language ? Check : this site
  • 10/26/2009 1:05 PM In reply to

    Re: Trying to resize my objects

    I don't know, since I'm multiplying, I pressumed the order wouldn't metter. How would it look like with your order?
  • 10/26/2009 1:13 PM In reply to

    Re: Trying to resize my objects

    manswide:
    since I'm multiplying, I pressumed the order wouldn't metter
    Not true. Indeed, what you are multiplying are matrices, which is different from the "basic" multiplication of numbers. if A and B are matrices, A*B is different from B*A. I know the order is very important in the world matrix. I don't have any code with me now, but I think I firstly do the "transforms[mesh.ParentBone.Index]" then the scale, and I don't remember which is the first between rotation and translation.
    You speak English, Spanish or French ? You need tutorials in your language ? You can make tutorials in your language ? Check : this site
  • 10/26/2009 2:38 PM In reply to

    Re: Trying to resize my objects

    The usual order is:

    effect.World = transforms[mesh.ParentBone.Index] * scaleMatrix * rotationMatrix * translationMatrix;
    Game hobbyist hell-bent on coding a diabolical Matrix
  • 10/26/2009 4:47 PM In reply to

    Re: Trying to resize my objects

    JIHO!!!
    Thanks a lot, guys, this made my week! Seriously.
Page 1 of 1 (7 items) Previous Next