Page 1 of 1
SetObjectRotation
Posted: Sat Oct 20, 2012 2:32 pm
by enric
id = PlaceObject(x, y, "Test", "pontoon_bridge_centre");
SetObjectRotation(id, 0);
or
SetObjectRotation(id, 90);
or
SetObjectRotation(id, 180);
Are not rotating according to the degree system, can you tell me which criteria should be followed to place objects in a precise direction?, or maybe I'm using the wrong functions.
Re: SetObjectRotation
Posted: Sat Oct 20, 2012 4:49 pm
by pipfromslitherine
As per the docs, the degrees are in 100ths, so you'll want to use 0, 9000, and 18000 in these examples. So they were indeed rotating already - just only by a max of 1.8 degrees
Cheers
Pip
Re: SetObjectRotation
Posted: Sat Oct 20, 2012 5:00 pm
by enric
ummmm, look at the picture, bottom left, the Engineers have placed a pontoon facing 0.
SetObjectRotation(id, 0);
On top, the other engineers have placed the same object with 27000.
Re: SetObjectRotation
Posted: Sat Oct 20, 2012 5:04 pm
by enric
ummmm, look at the picture, bottom left, the Engineers have placed a pontoon facing 0.
SetObjectRotation(id, 0);
On top, the other engineers have placed the same object with 27000.

- Screen Shot 2012-10-20 at 18.57.29.jpg (71.78 KiB) Viewed 1378 times
Re: SetObjectRotation
Posted: Sat Oct 20, 2012 6:40 pm
by enric
The only working numbers are 0 and 157.
0 are vertical tiles, and 157 horizontal, is there any logic here that I' missing ?.

- Screen Shot 2012-10-20 at 20.36.10.jpg (150.28 KiB) Viewed 1375 times
Re: SetObjectRotation
Posted: Sat Oct 20, 2012 11:32 pm
by pipfromslitherine
Hmmm - I'm pretty sure I tested it when I wrote it. And I've not got the code in front of me right now. But on a hunch, try doing it in radians. That is, make the value you put into the function be:
value = (100 * degrees * PI)/180
If that works, then I forgot to do the conversion. If not, I'll have to double check it. I'm guessing it is used by the random mission mods, so I think it must work at least somewhat.
Cheers
Pip
Re: SetObjectRotation
Posted: Sun Oct 21, 2012 7:48 am
by enric
value = (100 * degrees * PI)/180
This formula gives 0 for 0 degrees and 157 for 90 degrees.
It's ok for me the 157 as I only want to place horizontal or vertical the object.
Re: SetObjectRotation
Posted: Sun Oct 21, 2012 2:39 pm
by pipfromslitherine
Yeah - that's what made me guess that that was the issue. I'll check and see whether I need to change either the code or the docs (I don't want to break any existing code when i make the fix)
Cheers
Pip