So, there is results of last bug we discuss:
r5349: all fine, no fall down.
r5350: can't start actual game, menu fine, but choice "new game" made app meditating in busy loop
r5151: can't start actual game, menu fine, but choice "new game" made app meditating in busy loop
r5152: can't start actual game, menu fine, but choice "new game" made app meditating in busy loop
r5153: game starts again, and there we already have fall down bug introduced.
Now, seeing that in r5153 you fix some thing done wrong in r5350, i then tried again r5350 and r5351 with that bugfix from 5153 applied (to see, is it exactly r5350 which is guilty, or r5351). And our winner commit 5350. I.e. 5349 no bug, 5350 (with bug-fix from r5153) bug is here.
Now i put bunch of prinfs to CSceneNodeAnimatorCollisionResponse::animateNode, to see where we go, so code looks like this then:
Code: Select all
void CSceneNodeAnimatorCollisionResponse::animateNode(ISceneNode* node, u32 timeMs)
{
printf("we inside of CSceneNodeAnimatorCollisionResponse::animateNode\n");fflush(stdout);
CollisionOccurred = false;
if (node != Object) {
printf("node != Object\n");fflush(stdout);
setNode(node);
}
if(!Object || !World) {
printf("!Object || !World\n");fflush(stdout);
return;
}
// trigger reset
if ( timeMs == 0 )
{
printf("tineMs == 0\n");fflush(stdout);
FirstUpdate = true;
timeMs = LastTime;
}
if ( FirstUpdate )
{
printf("FirstUpdate\n");fflush(stdout);
LastPosition = Object->getPosition();
Falling = false;
LastTime = timeMs;
FallingVelocity.set ( 0, 0, 0 );
FirstUpdate = false;
}
const f32 diffSec = (f32)(timeMs - LastTime)*0.001f;
LastTime = timeMs;
CollisionResultPosition = Object->getPosition();
core::vector3df vel = CollisionResultPosition - LastPosition;
FallingVelocity += Gravity * diffSec;
CollisionTriangle = RefTriangle;
CollisionPoint = core::vector3df();
CollisionResultPosition = core::vector3df();
CollisionNode = 0;
// core::vector3df force = vel + FallingVelocity;
if ( AnimateCameraTarget )
{
printf("AnimateCameraTarget\n");fflush(stdout);
// TODO: divide SlidingSpeed by frame time
bool f = false;
CollisionResultPosition
= SceneManager->getSceneCollisionManager()->getCollisionResultPosition(
World, LastPosition-Translation,
Radius, vel, CollisionTriangle, CollisionPoint, f,
CollisionNode, SlidingSpeed, FallingVelocity*diffSec);
CollisionOccurred = (CollisionTriangle != RefTriangle);
CollisionResultPosition += Translation;
if ( diffSec > 0 ) // don't change the state when there was no time
{
printf("diffSec >0\n");fflush(stdout);
if (f)//CollisionTriangle == RefTriangle)
{
printf("Falling = true\n");fflush(stdout);
Falling = true;
}
else
{
printf("Falling = false\n");fflush(stdout);
Falling = false;
FallingVelocity.set(0, 0, 0);
}
}
bool collisionConsumed = false;
if (CollisionOccurred && CollisionCallback) {
printf("CollisionOccurred && CollisionCallback\n");fflush(stdout);
collisionConsumed = CollisionCallback->onCollision(*this);
}
if(!collisionConsumed)
printf("!collisionConsumed\n");fflush(stdout);
Object->setPosition(CollisionResultPosition);
}
// move camera target
if (AnimateCameraTarget && IsCamera)
{
printf("AnimateCameraTarget && IsCamera\n");fflush(stdout);
const core::vector3df pdiff = Object->getPosition() - LastPosition - vel;
ICameraSceneNode* cam = (ICameraSceneNode*)Object;
cam->setTarget(cam->getTarget() + pdiff);
}
LastPosition = Object->getPosition();
}
And that what i have in return when tried to play in game:
Code: Select all
we inside of CSceneNodeAnimatorCollisionResponse::animateNode
AnimateCameraTarget
diffSec >0
Falling = false
!collisionConsumed
we inside of CSceneNodeAnimatorCollisionResponse::animateNode
AnimateCameraTarget
diffSec >0
Falling = false
!collisionConsumed
we inside of CSceneNodeAnimatorCollisionResponse::animateNode
AnimateCameraTarget
diffSec >0
Falling = true
!collisionConsumed
we inside of CSceneNodeAnimatorCollisionResponse::animateNode
AnimateCameraTarget
diffSec >0
Falling = false
!collisionConsumed
we inside of CSceneNodeAnimatorCollisionResponse::animateNode
AnimateCameraTarget
diffSec >0
Falling = false
!collisionConsumed
we inside of CSceneNodeAnimatorCollisionResponse::animateNode
AnimateCameraTarget
diffSec >0
Falling = false
!collisionConsumed
we inside of CSceneNodeAnimatorCollisionResponse::animateNode
AnimateCameraTarget
diffSec >0
Falling = true
!collisionConsumed
we inside of CSceneNodeAnimatorCollisionResponse::animateNode
AnimateCameraTarget
diffSec >0
Falling = false
!collisionConsumed
we inside of CSceneNodeAnimatorCollisionResponse::animateNode
AnimateCameraTarget
diffSec >0
Falling = false
!collisionConsumed
And so on. Sometime i can see that "Falling = true" instead, but very rare, and dunno if it anyhow important there.
Have any ideas what next ?:)
EDIT: maybe getCollisionPoint() rewrite have a bug ? Because that one which use game a lot, and that what i see in r5350 was changed.
EDIT2: if i do grep on word "collision" in all the .cpp files game use, then those ones i find: createCollisionResponseAnimator(),getCollisionPoint() and setCollisionCallback(). Nothing else seems so. And from those 3 i see that in r5350 only getCollisionPoint() was in touch.