(07-28-2013, 10:42 AM)The chaser Wrote: AddBodyForce("Door_body_1", 0, 0, 0, "world"); ///Without Body force, it
Just to add to this, if you use the coordinate setting "local" rather than "world" as the 5th parameter, then it uses the coordinates (x,y,z) of the door entity itself, rather than the whole world. That means that if you have 2 doors at a right angle to each other, you can apply force in the same direction and it will still open it, meaning you can use 1 generic function for any door
For example, I used this function in a test i was doing
void OnStart()
{
SetEntityPlayerInteractCallback("castle_1", "OpenTheDoors", false);
SetEntityPlayerInteractCallback("castle_arched01_1", "OpenTheDoors", false);
SetEntityPlayerInteractCallback("prison_1", "OpenTheDoors", false);
SetEntityPlayerInteractCallback("sewer_arched_1", "OpenTheDoors", false);
SetEntityPlayerInteractCallback("metal_1", "OpenTheDoors", false);
}
void OpenTheDoors(string &in strEnt)
{
SetSwingDoorDisableAutoClose(strEnt, true);
if (GetSwingDoorClosed(strEnt)) SetSwingDoorClosed(strEnt, false, true);
AddPropImpulse(strEnt, 0, 0, 4, "Local");
}
That meant I could call OpenTheDoors("name_of_any_door") or use SetEntityPlayerInteractCallback to swing open any door, keeping the function generic enough to work (with the exception of mansion doors, iirc)
Should be easy to transfer that idea to using an area collide callback