This project is read-only.

GroundMarker question

Oct 3, 2011 at 8:32 AM

is there a way to set the ground static? in other words what i want to do is i want the user to set the ground using the groundmarker and then he/she won't need it anymore. so somehow need to transform the groundmarker worldtransformation to another node that is just static. i tried to do it with geometryNode but it either shows the objects zoomed in, or doesn't register them in the physics engine. depending on if I add the groundMarker(a geometryNode with a simple box model) to physics engine. 

i have an initialGroundMarkerNode that is 

initialGroundMarkerNode = new MarkerNode(scene.MarkerTracker, "ALVARGroundArray.xml");

then i have 


GeometryNode groundMarkerNode = new GeometryNode();

groundMarkerNode.Model = new Box(0.1f);

groundMarkerNode.AddToPhysicsEngine = true; // if this is set to false, then i have the physics of the other objects added to this node working(i can tell because i hear the sphere moving and hitting sound) but they all are so zoomed in that you can't see anything. but if it is set to true then everything seems normal but the sphere doesn't move.


in my draw method when the user hits S(for selecting) key, i have


groundMarkerNode.Physics.InitialWorldTransform = initialGroundMarkerNode.WorldTransformation;



and what it does in the createObjects is, it creates some objects and adds them to groundMarkerNode(which is not really a marker node, but a geometryNode). one of the objects is a sphere and it has an initial velocity. but for some reason it doesn't move at all. also I have two other markers that are kind of like toolbarMarkerArray and they do not show up either using

((NewtonPhysics)scene.PhysicsEngine).SetTransform(boxNode1.Physics, mat1);

Oct 14, 2011 at 4:29 PM
Edited Oct 14, 2011 at 4:29 PM

Once you've already added the ground to the physics engine by setting AddToPhysicsEngine to true, the Physics.InitialWorldTransform won't take effect anymore (it's ignored), so you will need to use the NewtonPhysics.SetTransform method to change its position. Meanwhile, if the object is not added to the physics engine yet, then you should set the Physics.InitialWorldTransform property to set their location. So for your ground node, either use SetTransform method or set AddToPhysicsEngine to true at the time the user hits S key.