maxest
Member
|
Problem with capsule - controller
I'm trying to configure capsule controller to work in my own fashion but I can't get it. First of all when I try to create a capsule with radius greater than 1.0 I get an error while the application is loading syaing that I specifiec invalid data. It happens to "all" capsules (not only for those being created for controllers)
The second problem is with updating the controller. I don't know why but the velocity I pass as the first parameter seems to be scaled down. When I pass, for example, Vec(1,0,0) the capsule is moving very slow, whereas other objects with the same velocity move as they should.
|
|
02-05-2009 08:20 PM |
|
Esenthel
Administrator
|
Re: Problem with capsule - controller
Hello,
1. capsule's radius cannot exceed or be equal to capsule's height/2,
if it exceeds the value then the capsule is invalid
in Esenthel Engine capsule's height means the total height
for example a capsule with total height=1 and radius=0.5, is not a capsule but it is a ball
let me know if you'll need more explanations on it
2. have you checked "physics/controllers" tutorial?
could you say what's different in updating the controller in your codes than in the tutorial code?
Thanks!
|
|
02-05-2009 08:53 PM |
|
maxest
Member
|
Re: Problem with capsule - controller
I've taken a look at the controllers tutorial but can't find the solution there.
Take a look:
Code:
Physics.sim().get();
Vec vel(1,0,0);
ctrl.update(Vec(1,0,0), Kb.shift, Kb.bp(KB_SPACE) ? 3.5 : 0);
Matrix posMatrix, rotMatrix, s;
s.setScale(0.01f);
static Vec pos(0,0,0);
pos.x += 1;
posMatrix.setPos(pos);
rotMatrix.setRotateY(-camera.horizontalAngle + PI/2.0f);
dragonSkeleton.clear();
dragonSkeleton.animate("data/meshes/test/Anim-1.anim", Tm.time());
dragonSkeleton.updateMatrix(s * rotMatrix * posMatrix);
The code above states that both, controller and dragonSkeleton, should move with exactly the same velocity, yet they don't.
Besided, is there a way to get/set controller's direct position?
|
|
02-05-2009 09:17 PM |
|
Esenthel
Administrator
|
Re: Problem with capsule - controller
you are forgetting about time
this is ok
ctrl.update(Vec(1,0,0), Kb.shift, Kb.bp(KB_SPACE) ? 3.5 : 0);
but when you change position according to velocity
you don't do pos.x += 1;
but you do pos.x += 1 * Tm.d();
change of position in frame is equal to velocity * time delta
|
|
02-05-2009 09:36 PM |
|
maxest
Member
|
Re: Problem with capsule - controller
Now it's ok. Imho you unnecessarily made inner multiplication of controller's velocity by delta time. What if I don't want my game to run at the same speed on every machine?
Can I manually set/get controller's position?
|
|
02-05-2009 09:48 PM |
|
Esenthel
Administrator
|
Re: Problem with capsule - controller
Quote:Imho you unnecessarily made inner multiplication of controller's velocity by delta time.
sorry, but you're wrong
Quote:What if I don't want my game to run at the same speed on every machine?
this doesn't make sense
Quote:Can I manually set/get controller's position?
void Controller::actor.pos(Vec &pos);
Vec Controller::actor.pos();
|
|
02-05-2009 09:53 PM |
|
maxest
Member
|
Re: Problem with capsule - controller
Quote:sorry, but you're wrong
After short thought I say you're right . I use such a small subset of Esenthel's functionality that I forgot it's the engine, not framework
Quote:void Controller::actor.pos(Vec &pos);
Vec Controller::actor.pos();
Quite obvious though
Thanks for help
|
|
02-05-2009 10:51 PM |
|