About Store Forum Documentation Contact



Post Reply 
Dynamic scale of Chr
Author Message
Brainache Offline
Member

Post: #1
Dynamic scale of Chr
Can you change the scale of a player dynamically?

I tried doing a player.matrix().scale(Vec (1,2,1)).. no effect..
tried setting it up in a preRender function also..


any suggestions?
11-06-2011 02:18 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #2
RE: Dynamic scale of Chr
Might be wrong about this, but I don't believe you can scale characters after creation. You will need to delete the player and use Game::World.objCreate to create a new player with a different scale.
11-06-2011 06:46 PM
Find all posts by this user Quote this message in a reply
Brainache Offline
Member

Post: #3
RE: Dynamic scale of Chr
I would prefer dynamic for sure... but even with this method - is it possible to scale by a Vec instead of float ( ie: non-uniform scale...) ?
11-06-2011 07:22 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #4
RE: Dynamic scale of Chr
I suppose so, but never tried. Game::World.objCreate has a matrix parameter, just change the scale of your matrix to be non-uniformed and see what happens.
11-06-2011 07:49 PM
Find all posts by this user Quote this message in a reply
Brainache Offline
Member

Post: #5
RE: Dynamic scale of Chr
Messed around with non-uniform scaling and got some odd results...

In all cases - object was scaled uniformly - acts like the .y,.z parm of the Vec is ignored..


Game::Obj *newObj = Game::World.objCreateNear(*obj,Matrix(Vec(5,1,1), sp ));
Object comes in scaled at x5 uniformly

Game::Obj *newObj = Game::World.objCreateNear(*obj,Matrix(Vec(1,5,1), sp ));
Object comes in scaled at x1 uniformly

Any ideas? ( thanks the pointers by the way!)
11-06-2011 08:23 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #6
RE: Dynamic scale of Chr
I just reread the header comments for objCreate/objCreateNear and noticed it says, "matrix scale will be used as objects scale." This is a clear sign as to why the y- and z-axis values are ignored (i.e. the matrix's scale value is equivalent to setting a value for Scale on an object via World Editor, it doesn't support non-uniform scaling).

However, it appears as if you can still draw objects using non-uniform scaling. For instance, this works:

Code:
void render()
{
   switch(Renderer())
   {
      case RM_PREPARE:
      {
         mesh.draw(Matrix3(Vec(10, 1, 1))); // draw using non-uniform scaling
      } break;
   }
}

Try setting the matrix again after objCreateNear or, if that doesn't work, perhaps this:

Code:
UInt Player::drawPrepare()
{
    SetMatrix(m); // set non-uniform scaling

    UInt modes = super::drawPrepare(); // draw character
    SetMatrix(); // clear matrix

    return modes;
}
11-07-2011 08:13 AM
Find all posts by this user Quote this message in a reply
Brainache Offline
Member

Post: #7
RE: Dynamic scale of Chr
hmm. i'll experiment with this - wondering if it would cause some issues with objects rendering differently than how they react to physics tho...
11-08-2011 12:59 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #8
RE: Dynamic scale of Chr
Game::Chr and CSkeleton do not support dynamic rescaling
11-08-2011 01:02 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #9
RE: Dynamic scale of Chr
you could do it by having Game::Chr sources (company license), and apply manual modifications to sources
11-08-2011 01:03 PM
Find all posts by this user Quote this message in a reply
Post Reply