Hi, I my project don't recognize the ToolBarTracker, can you help me with that?
public void CreateObjectArrow()
ModelLoader loader = new ModelLoader();
//Sp�cification de mon modele
Model arrowModel = (Model)loader.Load(@path+"\\Content\\Arrow\\", "Arrow");
arrowModel.UseInternalMaterials = true;
arrowModel.CastShadows = true;
arrowModel.ReceiveShadows = true;
// Create a geometry node with a model of a box that will be overlaid on
// top of the ground marker array initially. (When the toolbar marker array is
// detected, it will be overlaid on top of the toolbar marker array.)
Arrow = new GeometryNode();
Arrow.Model = arrowModel;
// Add this box model to the physics engine for collision detection
Arrow.AddToPhysicsEngine = true;
Arrow.Physics.Shape = ShapeType.Box;
// Make this box model cast and receive shadows
Arrow.Model.CastShadows = true;
Arrow.Model.ReceiveShadows = true;
// Create a marker node to track a toolbar marker array.
toolBarMarker = new MarkerNode(scene.MarkerTracker, "Toolbar.txt");
transNodeArrow = new TransformNode();
transNodeArrow.Scale = new Vector3(9f, 9f, 9f);
transNodeArrow.Translation = new Vector3(0, 0, 15);
transNodeArrow.Rotation = Quaternion.CreateFromAxisAngle(Vector3.UnitX, 190);
transNodeArrow.Rotation *= Quaternion.CreateFromAxisAngle(Vector3.UnitY, 190);
// Create a material to apply to the box model
Material boxMaterial = new Material();
boxMaterial.Diffuse = new Vector4(0.5f, 0, 0, 1);
boxMaterial.Specular = Color.White.ToVector4();
boxMaterial.SpecularPower = 10;
Arrow.Material = boxMaterial;
// Add this box model node to the ground marker node
// Create a collision pair and add a collision callback function that will be
// called when the pair collides
NewtonPhysics.CollisionPair pair = new NewtonPhysics.CollisionPair(Arrow.Physics, gandalfNode.Physics);
NewtonPhysics.CollisionPair pair2 = new NewtonPhysics.CollisionPair(Arrow.Physics, sauronNode.Physics);
Your code seems OK. Can you be more specific of what you are trying to do and what happens when you run your program?
The piece of code you've posted adds a MarkerNode to the scene, but doesn't attach any children to it. For something to be attached to the marker visually, you'll either have to add children to it or do something with it in your Draw/Update functions.
For example, in Tutorial 8, Ohan checks if the marker is detected inside the Draw loop and then applies a transform to an object so that it looks like the object is attached to the marker. Speaking of Tutorial 8, can you use the toolbar to interact
with the scene?
By the way, all angles are defined as radians in XNA, in the line "Quaternion.CreateFromAxisAngle(Vector3.UnitX, 190);" it seems like you were trying to rotate by 190 degrees. You can use the MathHelper.ToRadians method to convert degrees to radians.
Thanks for the angle, I didn't attach any object yet, I have in my Draw :
I put a breakpoint in the toolbarMarker's if. but when I show the groundMarker and the toolBar to the camera, it doesn't recognize my toolBar...only my ground.