Fallen cubes

Mar 13, 2011 at 8:11 PM
Edited Mar 15, 2011 at 6:07 AM

I was trying to leave fall cubes on ground, so I use some coordinates for farPoint and nearPoint and near values with my based point far and near (I got these values from goblin xna 3.5 when I shot ball on the ground).
Everything was ok, but now when I use this code:
            TransformNode modelTransNode = new TransformNode();
Cubes are not fallen on the right place, there is something wrong with transformation, my question is, if in this function there is something needed to take account when I add to markerNode some child (geometryNode or transformNode), to be position the same like when I am using only markerNode and I only add scene like scene.RootNode.AddChild(markerNode);

                Vector3 nearSource = new Vector3(uiState.CrossHairPoint.X, uiState.CrossHairPoint.Y, 0);
                Vector3 farSource = new Vector3(uiState.CrossHairPoint.X, uiState.CrossHairPoint.Y, 1);
                Matrix viewMatrix = markerNode.WorldTransformation * State.ViewMatrix;
                Vector3 nearPoint = graphics.GraphicsDevice.Viewport.Unproject(nearSource,
                    State.ProjectionMatrix, viewMatrix, Matrix.Identity);
                Vector3 farPoint = graphics.GraphicsDevice.Viewport.Unproject(farSource,
                    State.ProjectionMatrix, viewMatrix, Matrix.Identity);

Thank you

Mar 15, 2011 at 12:47 PM

Where does it exactly fall?

There shouldn't be any problems adding transform node below marker nodes.

If you see the ARDomino project under GoblinXNA/projects directory, that's how I define domino's original locations relative to the marker array (line 1354).

You might have something missing, so please take a careful look at ARDomino project since it shows physics simulation in AR.


Mar 16, 2011 at 8:20 AM
Edited Mar 16, 2011 at 8:43 AM

Hi, thank you for answer, I was debugging my code, I noticed that it is wrong only when I use fbx. model like modelNode, some my model don't change tranformation but some do. In 3ds max I set for every model position 0,0,0, and when I  give these modelNode to markerNode, fallen cubes are on the different place (for different models).  When I try set for example ((TransformNode)dominoNode.Parent).Translation = new Vector3(0,90,0); It was ok with using some models, there is some trans, but I want for all my model to have the same behavior, maybe I have to set something for model to not change my transformation. Because when I have position new Vector(0,0,0) every model is displayed exactly on the marker but some of them change position fallen cubes, some not. I don't understand why or how it has affect when I use some fbx model on position fallen cubes.


Mar 16, 2011 at 1:13 PM

Hmmm... You're using physics engine, right? If so, why don't you set Scene.RenderCollisionMesh to true. Make sure the collision mesh assigned to your model looks correct. What PhysicsType are you using? If you see the collision mesh is wrong, then please send your model to me so that I can debug.


Mar 16, 2011 at 7:45 PM
Edited Mar 16, 2011 at 8:01 PM

I am using NewtonPhysics(), I tried set Scene.RenderCollisionMesh to true.  I think collision mesh is assigned ok to model.  On the first link is picture where I use model which changes trans coordinate z (boxes are higher than ground) , on the third place there is link on the picture where I use another model and position of boxes is exactly on the ground, on the second place is link with problem model and collision mesh.





Mar 17, 2011 at 12:35 AM

What's the difference between the boxes in the first image and the 3rd image? If you'd like me to see the problem, I need to have the models that cause problems.


Mar 17, 2011 at 7:50 AM
Edited Mar 17, 2011 at 8:30 AM

I add transNode to markerNode and boxNode to transNode like child, for fbx model, and then for fallen boxes the same way I add fallen boxes to transNode and markerNode. But in the first image I use model for example 1.fbx and boxes are higher than groundNode, and when I use for example 2.fbx like model, boxes are on the position like when I don't use model fbx, nothing is changes. I can send you two models, one moves boxes higher (z) (thonet), second model moves boxes more to background (y) (thonet_chair1).  Where can I send you models?



Mar 17, 2011 at 2:43 PM

" I use model for example 1.fbx and boxes are higher than groundNode, and when I use for example 2.fbx like model, boxes are on the position like when I don't use model fbx", I don't quite understand this sentence. Is the position set in the model internally, or in your transNode?

Please send to ohan@cs.columbia.edu


Mar 17, 2011 at 3:17 PM
Edited Apr 1, 2011 at 8:01 PM


I have sent you email with models, I set position for model like modelNode.translation = new Vector3(0,0,0), so I use transNode. I try to explain shortly all project. I have on markers some models, some text information on the markers belong to models. And now I am trying to make bord game, I have som players on the markes and so on, so I want to generate cube like in some board game. When I give directly to code where I work with model model "thonet", and I give this model to transNode and markerNode, in other class I give boxes for board game to transNode and markerNode, and then I run application with models, text information, boxes and so on, I can see this image http://img217.imageshack.us/i/boxesb.png/, when I change directly in source code model "thonet" on different model and I run application I can see this image http://img8.imageshack.us/i/boxes2.png/. So I change in code only model, no translation and boxes are falling on the different position.

If you want to see the problem you can try add model thonet on other marker for example in dominogame and then try shooting balls.




Apr 1, 2011 at 8:01 PM
Edited Apr 1, 2011 at 8:10 PM

My problem is resolved.
I decided that I do not want physic engine for 3dmodels, when I give away this line modelNode.AddToPhysicsEngine = true; cubes are fallen exactly on the ground. I didn't realize that when I have 3d models in physic engine, although 3d models are not displayed on the scene they have effect for fallen cubes. Sorry.