O Ilusionista
Captain 100K
I've customized a function so I can spawn an entity with desired position, veloctiy and animation.
It works perfectly...minus the direciton. The spawned entity always faces right, even when the caller entity is facing left.
Can anyone help me to track what is wrong?
SOLVED:
The issue is related with "Drawmethod Clip" (which I was using on the spawned entity). Seams that it ignores the direction.
It works perfectly...minus the direciton. The spawned entity always faces right, even when the caller entity is facing left.
Can anyone help me to track what is wrong?
Code:
void spawnAni(void vName, float fX, float fY, float fZ, void Ani, float Vx, float Vy, float Vz)
{
//spawnB (Generic spawner) + Specific animation + velocities
//Damon Vaughn Caskey + Douglas Baldan
//07/06/2007
//
//Spawns entity next to caller.
//
//vName: Model name of entity to be spawned in.
//fX: X location adjustment.
//fZ: Y location adjustment.
//fY: Z location adjustment.
void self = getlocalvar("self"); //Get calling entity.
void vSpawn; //Spawn object.
int iDirection = getentityproperty(self, "direction");
clearspawnentry(); //Clear current spawn entry.
setspawnentry("name", vName); //Acquire spawn entity by name.
if (iDirection == 0){ //Is entity facing left?
fX = -fX; //Reverse X direction to match facing.
Vx = -Vx; //Reverse X velocity
}
fX = fX + getentityproperty(self, "x"); //Get X location and add adjustment.
fY = fY + getentityproperty(self, "a"); //Get Y location and add adjustment.
fZ = fZ + getentityproperty(self, "z"); //Get Z location and add adjustment.
vSpawn = spawn(); //Spawn in entity.
changeentityproperty(vSpawn, "position", fX, fZ, fY); //Set spawn location.
changeentityproperty(vSpawn, "direction", iDirection); //Set direction.
changeentityproperty(vSpawn, "velocity", Vx, Vy, Vz);
performattack(vSpawn, openborconstant(Ani), 1);
return vSpawn; //Return spawn.
}
SOLVED:
The issue is related with "Drawmethod Clip" (which I was using on the spawned entity). Seams that it ignores the direction.