Marker object move downward/upward

Nov 23, 2011 at 2:19 AM

I don't know why, box object which I set on the ground marker move downward/upward (depends on how I hold the marker) and finally stopped at a particular position.

why is this happening?

Nov 23, 2011 at 4:33 AM

If you face the marker parallel to the camera, it will get confused as to which the marker is facing. It's a known problem that's hard to solve. There are also few tracking bugs in ALVAR. VTT folks are trying to make it more robust.


Nov 23, 2011 at 6:37 AM

is there any workaround of it? is it possible to use groundMarker.WorldTransformation to make the ground object stick to the marker.

where should I put the code? in the update method? still confused

Nov 24, 2011 at 12:15 AM
Edited Nov 24, 2011 at 12:17 AM

Finally fixed it. In Draw() method I simply multiply marker worldTransformation with offset vector3 bounds by matrix.CreateTranslation()

and apply the result with NewtonPhysics SetTransform

((NewtonPhysics)scene.PhysicsEngine).SetTransform(groundNode.Physics, mat);

and the ground object remains on the marker.

Nov 24, 2011 at 1:13 AM
Edited Nov 24, 2011 at 1:18 AM

Another problem but nothing got to do with the groundmarker. Now, it's about the sphere object thrown to the ground object ignited by mouse click.

when the ball lands to the ground object (box), it is like glued to the box. I wanted it to roll and finally fall down. I've adjusted the values of kinetic and static friction. But that don't help. What else do I need to look or perhaps any additional code that I need to put in

my code (excerpt of the NewtonMaterial values inside the Initialize(method)

// Set up physics material interaction specifications between the shooting box and the ground
            NewtonMaterial physMat = new NewtonMaterial();
            physMat.MaterialName1 = "BowlingBall";
            physMat.MaterialName2 = "Ground";
            physMat.Elasticity = 0f;
            physMat.StaticFriction = 2f;
            physMat.KineticFriction = 0.9f; 

CreateObject() method
private void CreateObjects()
            bowlingAlley = new Box(Vector3.One);
            Material bowlingAlleyMaterial = new Material();
            bowlingAlleyMaterial.Specular = Color.Brown.ToVector4();
            bowlingAlleyMaterial.Diffuse = Color.BurlyWood.ToVector4();
            bowlingAlleyMaterial.SpecularPower = 45;

            bowlingBall = new Sphere(3f, 50, 50);
            bowlingBallMaterial = new Material();
            bowlingBallMaterial.Specular = Color.Black.ToVector4();
            bowlingBallMaterial.Diffuse = Color.BlanchedAlmond.ToVector4();

            alleyGroundMarker = new MarkerNode(scene.MarkerTracker, "AlvarGroundArray.xml");
            groundNode = new GeometryNode("Ground");
            groundNode.Model = bowlingAlley;
            groundNode.Material = bowlingAlleyMaterial;

            groundNode.Physics.MaterialName = "Ground";
            groundNode.Physics.Interactable = true;
            groundNode.Physics.Collidable = true;
            groundNode.Physics.Shape = GoblinXNA.Physics.ShapeType.Box;            
            groundNode.AddToPhysicsEngine = true;

            // Create a parent transformation for both the ground and the sphere models
            TransformNode transformBowlingAlley = new TransformNode();
            transformBowlingAlley.Translation = new Vector3(0,-10,-20);

            // Create a scale transformation for the ground to make it bigger
            TransformNode groundScaleNode = new TransformNode();
            groundScaleNode.Scale = new Vector3(400, 400, 10);

            // Add this ground model to the scene

ShootBall() method
private void ShootBall(Vector3 near, Vector3 far)
            GeometryNode bowlingBallNode = new GeometryNode("BowlingBall" + shooterID++);
            bowlingBallNode.Model = bowlingBall;
            bowlingBallNode.Material = bowlingBallMaterial;

            bowlingBallNode.Physics.MaterialName = "BowlingBall";
            bowlingBallNode.Physics.Interactable = true;
            bowlingBallNode.Physics.Collidable = true;
            bowlingBallNode.Physics.Shape = GoblinXNA.Physics.ShapeType.Sphere;            
            bowlingBallNode.Physics.Mass = 6f;
            bowlingBallNode.AddToPhysicsEngine = true;
            // Calculate the direction to shoot the box based on the near and far point
            Vector3 linVel = far - near;
            // Multiply the direction with the velocity of 20
            linVel *= 60f;

            bowlingBallNode.Physics.InitialLinearVelocity = linVel;
            bowlingBallNode.Physics.InitialWorldTransform = Matrix.CreateTranslation(near);


thanks and appreciate any helps