Frictional Games Forum (read-only)
[SOLVED] Still Having Problems With Opening Cabinets - 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: [SOLVED] Still Having Problems With Opening Cabinets (/thread-13155.html)



[SOLVED] Still Having Problems With Opening Cabinets - Strembitsky - 02-07-2012

I have gotten the cabinet to close once inside. I then want it to open. When I use this code:
Code:
AddPropForce("cabinet_nice_1", -1000, -1000, -1000, "World");

The doors only twitch a little bit, and don't stay open. I have disabled the door auto-close, and I have made sure nothing is blocking it on the other side. Can someone please help?


RE: Still Having Problems With Opening Cabinets - flamez3 - 02-07-2012

Use "world" instead of "World", you are pushing them too hard. Make it like 10 or something.

You could set another cabinet active that has the door's open. Up to you.


RE: Still Having Problems With Opening Cabinets - Ninami - 02-07-2012

And remember to double check that a "-" sign is needed in order to open the cabinet. I had that problem before, I tried to open a cabinet with force, I used -10 but in my world, a -10 would force my cabinet the wrong way, so I just changed it to 10 and it worked.


RE: Still Having Problems With Opening Cabinets - palistov - 02-07-2012

When you use AddPropForce it applies the force to the entire object as a whole. The cabinet is static aside from the doors, so using AddPropForce won't work the way you want. Instead, you'll want to use these two functions. Instead of applying the force to the whole prop, it applies it to specific bodies, in this case the two cabinet doors.

PHP Code:
AddBodyImpulse("cabinet_nice_1_Body_1"fXfYfZ"World");
AddBodyImpulse("cabinet_nice_1_Body_2"fXfYfZ"World"); 

As usual, make sure you tweak the X, Y and Z forces until the cabinet doors open the way you want them to.


RE: Still Having Problems With Opening Cabinets - Strembitsky - 02-07-2012

I don't have access to my editor now, but the above seems like it'll work, so for now the thread will be solved. Thanks a lot! Have some rep.