xamarin / urho

Code to integrate with the Urho3D engine
Other
462 stars 122 forks source link

Question about left hand coordinates #405

Closed btschumy closed 4 years ago

btschumy commented 4 years ago

This is probably a newbie misunderstanding, but I have a question about the default UrhoSharp coordinates. In the Conventions section of the Urho3D documentation it says:

However, when using the UrhoSharp implementation I see positive X pointing to the left. Positive Y & Z do indeed point up and forward.

This is driving me crazy because I am trying to port code from an iOS SceneKit implementation and there the coordinates are left handed as described in the above conventions.

Here is the code that is setting the scene up:

    scene = new Scene();
    octree = scene.CreateComponent<Octree>();

    universeNode = scene.CreateChild();
    universeNode.SetScale(Const.SCENE_SCALE);

    cameraPanNode = scene.CreateChild();
    CameraNode = cameraPanNode.CreateChild();
    camera = CameraNode.CreateComponent<Camera>();
    CameraNode.Position = new Vector3(0, 0, Const.DEFAULT_POV_DISTANCE * Const.SCENE_SCALE);

Can someone help me understand what is going on here? I don’t have any code anywhere (to my knowledge) that would flip the coordinate system.

If this is they way it is in UrhoSharp by default, is there a simple way to change it?

freever commented 4 years ago

The coordinate system does indeed function as described on the box, with X increasing to the right of screen. Can you share some more code that draws something on the screen?

btschumy commented 4 years ago

OK, I think I have resolved this. Apparently SceneKit uses a right hand coordinate system while Urho uses a left handed one. That explains the discrepancy and my confusion.