Oto is shaking while moving

  1. I have placed Oto on a platform.But he is for some unknown reason,it is shaking as it moves.Video Attached.If you look closely the vibration starts at the very begning.Then it continues as i move forward.It stops as I stop moving.I have attached debug shape.

    What is causing the vibration?



    http://www.youtube.com/watch?v=0_ch-1Ya2VU



    for Oto setup, in method simpleUpdate

    [java] Spatial model_player = assetManager.loadModel(“Models/Oto/Oto.mesh.xml”);

    model_player.setLocalScale(0.1f);

    model_player.setLocalRotation(new Quaternion().fromAngleAxis(FastMath.PI , new Vector3f(0,1,0)));

    pn_player = new PhysicsCharacterNode(new CapsuleCollisionShape(.35f,.32f), 0.05f);

    pn_player.attachChild(model_player);

    pn_player.setGravity(17);

    pn_player.setFallSpeed(17);

    pn_player.setJumpSpeed(8);

    pn_player.setLocalTranslation(0,35,8);[/java]



    for Camera, in method simpleUpdate

    [java] cam.setDirection(new Vector3f(-.7f,-.2f,-1f));

    cam.setLocation(new Vector3f(pn_player.getLocalTranslation().getX()+3, pn_player.getLocalTranslation().getY()+1,pn_player.getLocalTranslation().getZ()+3f));[/java]



    for Animation, in method onAction

    [java] if (!animChannel.getAnimationName().equals(“Walk”)) {

    animChannel.setAnim(“Walk”, 0f);

    //animChannel.setLoopMode(LoopMode.Loop);

    }[/java]



    for movement, in method simpleUpdate

    [java] if (right) { walkDirection = new Vector3f(0, 0, -0.02f);}[/java]




  2. this line contains only constant.

    [java]cam.setDirection(new Vector3f(-.7f,-.2f,-1f));[/java]



    but, when I take this line from simpleUpdate to simpleInitApp, the cam position should remain the same.But, it changes its position.Why is this happening?(Do I need to provide screen shot)

If you’re using a PhysicsCharacterNode, try this in your simpleUpdate at the beginning of the method… I think:



[java]

public void simpleUpdate(float tpf) {

// These two are a quick-fix for PhysicsCharacterNode Jitter

rootNode.updateLogicalState(tpf);

rootNode.updateGeometricState();

}[/java]



There was a post a few weeks ago where this was a posted solution to someone’s jitter issues with it. It’s not a permanent fix, but it seems to work for now.



Rock onnnn

~FlaH

3 Likes

Thanks, it working ok now.



But, what does these two lines mean?



EDIT: I have noticed that [java]rootNode.updateLogicalState(tpf);[/java] is not needed.The updateGeometricState() alone resolves the issue.

You should still use updateLogicalState(tpf); because otherwise you will get problems as soon as you add effects. If you try to update the geometric state when the logical state is not updated you will get an exception.

Any idea why that happens? Ideally this fix shouldn’t be needed.

Nope, I guess local updates… Its happening since they are in. Its the updateGeometricState() of the PhysicsGhostNode provoking this probably…