Frictional Games Forum (read-only)
Position relative to what? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Open Source Collaboration (https://www.frictionalgames.com/forum/forum-27.html)
+--- Forum: HPL1 Engine (https://www.frictionalgames.com/forum/forum-28.html)
+--- Thread: Position relative to what? (/thread-24667.html)



Position relative to what? - jorgeas80 - 02-20-2014

Hello,

In HPL1Engine, every 3D entity has a defined position (X, Y, Z). My question is: relative to what? Other way: How is the coordinate system defined? If an object is at (0, 0, 0), where is it? Is there a "world" element that defines a coordinate system?

Sorry for the basic question. I don't have experience with 3D programming and videogames. I need to transform the coordinates of the light objects of the game to another coordinate system, and logging their values, I see negative numbers. I don't know what they mean, or how the coordinate system is built


RE: Position relative to what? - WALP - 02-21-2014

If an object is at 0 0 0 it is at the center of the world, which has its own cordinate system, commonly refererred to as either world or global cordinates.
At the very least this is how I have understood.


RE: Position relative to what? - jorgeas80 - 02-21-2014

(02-21-2014, 06:41 AM)The Mug Wrote: If an object is at 0 0 0 it is at the center of the world, which has its own cordinate system, commonly refererred to as either world or global cordinates.
At the very least this is how I have understood.

Thanks for your response. Yes, that was what I thought. In my mind, a "world" is basically the map you're playing on. The coordinate system of that world (map) starts at (0, 0, 0). But is it an arbitrary point? Is the centroid of the polygon defining the XZ plane of the map?

I need to know how this coordinate system is created, because I'm going to transform the coordinates of some elements put in the world (the lights) to another coordinate system, defined in the real world (my room).


RE: Position relative to what? - Romulator - 02-21-2014

Well, I know you're working with Penumbra, but I turned to AAMFP assets to look at sizes.

The 4x8m road which can be found in the streets for static_objects is what I used in this example.

I took the long side of the road and put it down at 0,0,0, without rescaling or rotating. At 0.25 snap, there are 32 squares along the Z-Axis. At 0.5, there are 16, and at 1.0, there is 8. Therefore having a 1.0 set as the snap sep. is equivalent to 1m.

Not ENTIRELY sure if it is the same for Penumbra, because I cannot develop with those if I don't have the game (Tongue) but those were my findings with that Smile

Edit: And no, not arbitrary. It is primarily the centre point of the whole map, the area which can be seen first in the perspective view, where the 3 Axis cross over (again, do not know if this is in Penumbra's dev tools).


RE: Position relative to what? - jorgeas80 - 02-21-2014

(02-21-2014, 01:52 PM)Romulator Wrote: Well, I know you're working with Penumbra, but I turned to AAMFP assets to look at sizes.

The 4x8m road which can be found in the streets for static_objects is what I used in this example.

I took the long side of the road and put it down at 0,0,0, without rescaling or rotating. At 0.25 snap, there are 32 squares along the Z-Axis. At 0.5, there are 16, and at 1.0, there is 8. Therefore having a 1.0 set as the snap sep. is equivalent to 1m.

Not ENTIRELY sure if it is the same for Penumbra, because I cannot develop with those if I don't have the game (Tongue) but those were my findings with that Smile

Edit: And no, not arbitrary. It is primarily the centre point of the whole map, the area which can be seen first in the perspective view, where the 3 Axis cross over (again, do not know if this is in Penumbra's dev tools).

Interesting finding. Thanks!

When you say "I took the long side of the road...", which tool have you used to get those numbers? I have Blender installed, not Maya or 3DMax.

Currently, I'm diving into the code, looking for the place where the world coordinates are set. If I know where is the (0, 0, 0) point in the World3D object (this is an actual object in the code), I can define this point in my space, and translate the position of the objects from one system (the game) to the other one (my own space)


RE: Position relative to what? - Romulator - 02-21-2014

Ahh! Well, I was using Amnesia: The Dark Descent's Level Editor to get relative sizes Blush

I haven't ever used Blender or anything similar to look at sizes, because I just place things on a map, not really into the model editting aspect :3

With that said, I would expect that xyz = 0 would be the exact centrepoint of the default cube which loads when you start a new project, at least globally. Locally however, it would probably be the centrepoint of any object.

Edit: This is what I mean: Setting the snap to 1.0, and putting it down on 0,0,0 on Amnesia's Level Editor gives you a 1m^2 of road (at least long ways Tongue) Though it doesn't help much Blender wise, it does give a perspective of relative size in Amnesia. If you can import such model, you can get an idea of sizes Smile Following the same formula, Amnesia's default walls are 4m long and 4m high. [Image: ff05tj.png]


RE: Position relative to what? - PutraenusAlivius - 02-21-2014

I think that in a modelling program, every space is defined by an absolute point that exactly in the middle of the space. The coordinates are EXACTLY, 0 0 0. They just added several points that deviate from that central coordinate in regular movements (1 block may be 0.25/0.125 meters apart).