Coordinates of the vertices in the world coordinate system

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
svedach
Posts: 20
Joined: Fri Oct 14, 2016 12:22 pm

Coordinates of the vertices in the world coordinate system

Post by svedach »

Good afternoon. I am using addMeshSceneNode(_Mesh) to create a graphic node. _Mesh is SMesh, and I create by specifying the vertices of triangles. Next, I need to get the coordinates of the vertices at the offset, rotation, and scale of the node. In the SMeshBuffer coordinates are not changed. How can I get the current coordinates of the vertices in the world coordinate system? Thank you.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Coordinates of the vertices in the world coordinate syst

Post by CuteAlien »

First way is to get the transformation matrix of the node (getAbsoluteTransformation) and use that matrix to transform all coordinates (transformVect).

Another solution is to create a triangle-selector which has functions then to get the transformed triangles.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
svedach
Posts: 20
Joined: Fri Oct 14, 2016 12:22 pm

Re: Coordinates of the vertices in the world coordinate syst

Post by svedach »

Well, thanks for the quick response, I have been working in this direction. I will describe the problem more generally, I imitate the sensor field of view and want use the method RayTest to check the presence of an object in a certain region, for that I generate endpoints with little extensibility in the corners (scan the area vertically and horizontally). Which method should I use to calculate the coordinates of the end points in terms of performance?
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Coordinates of the vertices in the world coordinate syst

Post by hendu »

The fastest way would be to transform the object's bounding box, and then use that, either as a box or as a sphere.
svedach
Posts: 20
Joined: Fri Oct 14, 2016 12:22 pm

Re: Coordinates of the vertices in the world coordinate syst

Post by svedach »

Thank you. I understand you offer not do a few RayTest, and instead create a sphere with which to check the intersection of objects? I just have hundreds of such sensors and to me it is very important to quickly calculate their ...
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Coordinates of the vertices in the world coordinate syst

Post by CuteAlien »

We do offer ray-tests with ISceneCollisionManager::getCollisionPoint (see http://irrlicht.sourceforge.net/docu/cl ... nager.html).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
svedach
Posts: 20
Joined: Fri Oct 14, 2016 12:22 pm

Re: Coordinates of the vertices in the world coordinate syst

Post by svedach »

I wonder ... Tell me, ISceneCollisionManager :: getCollisionPoint faster than g_PhysicalWorld-> GetWorld () -> rayTest (Start, End, RayCallBack)? And whether it is possible to perform ISceneCollisionManager :: getCollisionPoint from multiple threads? Should I use ITriangleSelector * selector or can pass NULL?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Coordinates of the vertices in the world coordinate syst

Post by CuteAlien »

No idea about that other rayTest function. getCollisionPoint needs a valid pointer to a triangle selector. Can be a metaTriangleSelector to have several selectors in one (as I found out last days that one has some bugs, so I'm rewriting it somewhat at the moment, but returns correct collisions, just wrong scenenode in some cases).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
svedach
Posts: 20
Joined: Fri Oct 14, 2016 12:22 pm

Re: Coordinates of the vertices in the world coordinate syst

Post by svedach »

Another function is the "btDiscreteDynamicsWorld :: rayTest" ... with help of this method, I want to find the nearest object. On GitHub have forks that allow this method to run in multiple threads ...
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Coordinates of the vertices in the world coordinate syst

Post by CuteAlien »

Really can't tell. I guess bt is bullet physics? Basically - experiment. Create as many nodes as you need for your test-case and then run a few tests with different functions and profile the results.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
svedach
Posts: 20
Joined: Fri Oct 14, 2016 12:22 pm

Re: Coordinates of the vertices in the world coordinate syst

Post by svedach »

Yes, you're absolutely right, it is a method of BulletPhysics. With nodes Irrlicht I define the position and rotation of the sensor. And uses this information to generate endpoint RayTest.
Post Reply