Re: Simple question - entity orientation


you are right, rotations represented by 4 components are called quaternions and they are used in .grp files exported from Sandbox, for example. Indeed having some insight about the structure and meaning of the orientation table would be of help, but from what I can tell it should only have three values (being x, y and z) as I have yet to see any script using more than those. In general, as far as LUA is concerned, I have never seen using quaternions... but I'm ready to be disproved on this :P

Going by logic, the three components in orientation probably form a vector: in fact, entities with no rotation facing the Y axis have {x = 0, y = 1, z = 0} while entities facing up (Z axis) have {x = 0, y = 0, z = 1}, but maybe it's more complex than this.

Re: Simple question - entity orientation

Hi joseph,
I was intrigued by this so I did some tests. First I tried a similar format to yours:
ID = System.SpawnEntity({class = "CurrentName", orientation = {x = 1, y = 0, z = 0.1}});

This fails, more specifically it causes my application (spawning an aircraft) to fail badly.
I then tried this variation:

local params = {class=CurrentName, orientation = {x = 1, y = 0, z = 0.1}};
ID = System.SpawnEntity(params);

This works perfectly! I have always used this variation, more from luck than by judgement! The first should work, but it may fail due to a problem with SpawnEntity.
So, this confirms that it does use vectors, and you should be able to make it work using the second variation.
Note, I'm using the free SDK (CE3) but it should be the same in CE5.

Who is online

Users browsing this forum: No registered users and 3 guests