Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building new objects with Flexible extension #129

Open
chinnuGarg opened this issue Nov 14, 2018 · 11 comments
Open

Building new objects with Flexible extension #129

chinnuGarg opened this issue Nov 14, 2018 · 11 comments

Comments

@chinnuGarg
Copy link

Hello reinterpret cat, great library.

I am colliding Ethan 3D model to the building and trying to get latlong of the corners for the same building.
If Ethan 3D model has already collided with the building, I will add a 3D cube on top of that building (as in https://github.com/reinterpretcat/utymap#flexible-extension) indicating the building’s location is already found.

On Collision of Ethan to the building, I am just getting the id of the building nothing more than that. And we need a node to use flexible extension.
So is it possible to do this?

@reinterpretcat
Copy link
Owner

You could try to add your collision detection script via https://github.com/reinterpretcat/utymap/blob/master/unity/demo/Assets/Scripts/Core/Plugins/GameObjectBuilder.cs::BuildFromMesh
Buildings are built in core library and they are materialized using BuildFromMesh method.

Another way is just to search for building's GameObject in scene using its id and knowing how are building names are generated.

Another way might involve search api implemented in core lib

@chinnuGarg
Copy link
Author

I did try adding collision detection but it is just giving me building ID rather than latlongs.

@reinterpretcat
Copy link
Owner

Have you tried to store lat/lon in your custom MonoBehaviour when you're attaching it to gameobject?

@chinnuGarg
Copy link
Author

What is the way to get the latlon for the buildings? Can I get it while i build the mesh in GameObjectBuilder css?

@reinterpretcat
Copy link
Owner

No, mesh geometry is already mapped to unity coordinates. Here you have raw geometry: https://github.com/reinterpretcat/utymap/blob/master/unity/demo/Assets/Scripts/Core/Interop/MapDataAdapter.cs

@chinnuGarg
Copy link
Author

Thank you.

Also isn't it possible to get all building objects in ThirdPersonBehaviour script? Normally we should be able to get gameobject as GameObject.Find() right?

@reinterpretcat
Copy link
Owner

It is not responsibility of ThirdPersonBehaviour class to handle logic with buildings.
Yes, you can search for GO using unity API

@chinnuGarg
Copy link
Author

Is it possible to create custom shaped building rather than rectangular buildings with the current raw data that OSM provides??

@reinterpretcat
Copy link
Owner

You can change or add new implementation for that based on current building builder implementation: https://github.com/reinterpretcat/utymap/tree/master/core/src/builders/buildings

@chinnuGarg
Copy link
Author

Does UtyMap provides any kind of latlong bounds to determine the centre of polygon or a building?

@reinterpretcat
Copy link
Owner

There is getCentroid function in https://github.com/reinterpretcat/utymap/blob/master/core/src/utils/GeometryUtils.hpp

However, there is two things to be aware:

  • convex vs non-convex polygons
  • building representation in osm might consist of multiple independent polygons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants