Brainache
Member
|
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 |
|
Driklyn
Member
|
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 |
|
Brainache
Member
|
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 |
|
Driklyn
Member
|
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 |
|
Brainache
Member
|
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 |
|
Driklyn
Member
|
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 |
|
Brainache
Member
|
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 |
|
Esenthel
Administrator
|
RE: Dynamic scale of Chr
Game::Chr and CSkeleton do not support dynamic rescaling
|
|
11-08-2011 01:02 PM |
|
Esenthel
Administrator
|
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 |
|