Frictional Games Forum (read-only)
AddAttachedPropToProp is broken? - 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: AddAttachedPropToProp is broken? (/thread-9358.html)



AddAttachedPropToProp is broken? - Apjjm - 07-25-2011

The function as described in the wiki.
Code:
void AddAttachedPropToProp(string& asPropName, string& asAttachName, string& asAttachFile, float afPosX, float afPosY, float afPosZ, float afRotX, float afRotY, float afRotZ);
However, upon usage i found that "afPosZ" does nothing, and "afRotz" controls both the Z-position and the Z-rotation. I set up a subdivision routine, to illustrate this point.

Image 1: "Swapped" order
Image 2: Order as described in wiki

In the second image, you can see that whilst there is clearly no rotation, there is also no depth, the Z-position parameter was ignored. When looking at the first image there is depth, but also a rotation around zx - the rotation parameter counted as both!

Below is the relevant function call I am making in my code:
Code:
//First image (Which shouldn't behave like this)
AddAttachedPropToProp(cp00,_cpQUAD,"sdiv"+sz+".ent",dx,dy,0,0,0,dz);
//Second image (Which should be correct!)
AddAttachedPropToProp(cp00,_cpQUAD,"sdiv"+sz+".ent",dx,dy,dz,0,0,0);

Any workarounds or chance of a fix? Smile

UPDATE:
Turns out it really is broken in that way, the following function fixes the problem, provided you do not want the attached prop to be rotated:
Code:
void FixedAttachPropToProp(string target, string attach, string entity, float x, float y, float z) {
   AddAttachedPropToProp(target,attach,entity,x,y,0,z,90,z); }