Frictional Games Forum (read-only)
[SCRIPT] [SOLVED] Rotate entity fixed amount of degrees - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] [SOLVED] Rotate entity fixed amount of degrees (/thread-24936.html)

Pages: 1 2


RE: Rotate entity fixed amount of degrees - Mudbill - 03-28-2014

I don't think this script must make the object rotate forever. Did you try disabling the AutoMove in the entity file?


RE: Rotate entity fixed amount of degrees - Reminiscity - 03-29-2014

(03-28-2014, 10:34 PM)Mudbill Wrote: I don't think this script must make the object rotate forever. Did you try disabling the AutoMove in the entity file?

Yes its turned off by default. I don't see anything in the script that would make it possible for it to stop at wanted degree tho Sad And when come to think of it, I can't think of a single part of amnesia tdd where they would need it so it might be that such a feature was never implemented... but then again is feels like such a basic thing to include in an engine doesn't it?xD


RE: Rotate entity fixed amount of degrees - Apfel - 03-29-2014

Hi there,

(03-28-2014, 10:00 PM)Reminiscity Wrote: If I knew what the speed of the rotation is measured in then I could calculate how long it has to be spinning. Right now the speed is 1... but what does that mean? 1 degree a second? No, that much I'm sure of derp xD But that would be the key to calculating an exact delay for the timer I guess.


it is measured in rad/s. That means a whole turn in one second would be achieved with a speed of 2*pi. ( well the acceleration must be very high though)
But I don't know how exact this will be.



regarding the issue with SetMoveObjectState, maybe you could try to reset it after one turn: ResetProp(string& asName);
The Player shouldn't note this, as it has the same position just like at the beginning. (not tested myself)


maybe that helps a bit.


RE: Rotate entity fixed amount of degrees - Reminiscity - 03-29-2014

ResetProp(string& asName); was the key to this work around! This is what I ended up with. This script controls a number of wheels so that's the reason for all the entity + "_wheel" stuff.

void symbolCombination(string &in entity) {

RotatePropToSpeed(entity + "_wheel", 1, 1, 120, 0, 0, true, "");

AddLocalVarInt(entity + "_spins", 1);
AddTimer(entity, 2.59f, "stopWheel");

}

void stopWheel(string &in asTimer)
{

StopPropMovement(asTimer + "_wheel");

if(GetLocalVarInt(asTimer + "_spins") == 3) {

SetLocalVarInt(asTimer + "_spins", 0);
ResetProp(asTimer + "_wheel");
}
}

And it works perfectly Smile Thank you all so much for taking the time to help me I really really appreciated it! Marking this as solved!