Ahh thanks much for the info on the sqrt()
Much appreciated.
More info on what is heavy on the cpu, would also be much appreciated.
the code is used like this up to like around 34 times a step - how many times varies 0-3900
actually im just going to put the code here.
void BonePosition()//float x,float y,float z)
{
float shift,bx,by,bz,px,py,pz ,btt=26,att=45;
int fen,b;
ddtime--;if(ddtime<0){ddtime=0;}
dbSetTextSize(32);
for(int en=0;BoneObjects[en]!=0 && en<100;en=en+1)//
{
if(dbObjectExist(BoneObjects[en]))
{
//if(sqrt(pow(dbObjectPositionX(CH)-dbObjectPositionX(BoneObjects[en]),2)+pow(dbObjectPositionY(CH)-dbObjectPositionY(BoneObjects[en]),2)+pow(dbObjectPositionZ(CH)-dbObjectPositionZ(BoneObjects[en]),2))<213)//longer range for ranged weapons??
if(dbObjectPositionX(CH)+213 > dbObjectPositionX(BoneObjects[en]) && dbObjectPositionX(CH)-213 < dbObjectPositionX(BoneObjects[en]) &&
dbObjectPositionZ(CH)+213 > dbObjectPositionZ(BoneObjects[en]) && dbObjectPositionZ(CH)-213< dbObjectPositionZ(BoneObjects[en]))
{
int a=0;//limb
do{
if(dbObjectExist(bones[en][a].objnum))
{
//if(dbObjectInScreen(bones[en][a].objnum) || BoneObjects[en]==CH)
{
if(!(dbObjectPositionX(CH)+13 > dbObjectPositionX(BoneObjects[en]) && dbObjectPositionX(CH)-13 < dbObjectPositionX(BoneObjects[en]) &&
dbObjectPositionZ(CH)+13 > dbObjectPositionZ(BoneObjects[en]) && dbObjectPositionZ(CH)-13< dbObjectPositionZ(BoneObjects[en])))
{
AutoAim(en,a);
}
/*Collision Check for limb rotation*/
int coll=SC_GroupCollision(bones[en][a].objnum,4);
if(coll>0)
{
fen=Fen(coll);
b=Flimb(fen,coll);
if(BoneObjects[fen]!=BoneObjects[en])
{
{
{
att=dbAtanFull(dbObjectPositionX(bones[fen][b].objnum)-dbObjectPositionX(bones[en][a].objnum),
dbObjectPositionZ(bones[fen][b].objnum)-dbObjectPositionZ(bones[en][a].objnum))-dbObjectAngleY(BoneObjects[en]);
btt=45.0;
bones[en][a].collision=true;
}
}
}
}else{
att=0; btt=0; bones[en][a].collision=false;
}
//*/
px=dbLimbPositionX(BoneObjects[en],bones[en][a].limbnum);
py=dbLimbPositionY(BoneObjects[en],bones[en][a].limbnum);
pz=dbLimbPositionZ(BoneObjects[en],bones[en][a].limbnum);
dbPositionObject(bones[en][a].objnum,px,py,pz);
dbRotateObject(bones[en][a].objnum,dbLimbDirectionX(BoneObjects[en],bones[en][a].limbnum),
dbLimbDirectionY(BoneObjects[en],bones[en][a].limbnum),dbLimbDirectionZ(BoneObjects[en],bones[en][a].limbnum));
dbTurnObjectRight(bones[en][a].objnum,90);
dbMoveObject(bones[en][a].objnum,(bones[en][a].length/2.0));
if(bones[en][a].dd>0)
{
if(ddtime==0)
{
bones[en][a].dd=0;
}
dbInk(dbRgb(91,0,0),13);
dbText(bones[en][a].dx,bones[en][a].dy,dbStr(bones[en][a].dd));
}
dbTurnObjectLeft(bones[en][a].objnum,90);
SC_UpdateObject(bones[en][a].objnum);
/*Vaway from attV*/
float ty=dbLimbAngleY(BoneObjects[en],bones[en][a].limbnum);//
float zy=dbLimbAngleZ(BoneObjects[en],bones[en][a].limbnum);//
dbRotateLimb(BoneObjects[en],bones[en][a].limbnum,0,dbLimbAngleY(BoneObjects[en],bones[en][a].limbnum)+(AngleBetween(dbLimbAngleY(BoneObjects[en],bones[en][a].limbnum),(((btt)*dbSin(btt))+(btt*dbCos(btt)))*dbSin(att-90))/(13.0))//+(dbRnd(32)/4.0)
,dbLimbAngleZ(BoneObjects[en],bones[en][a].limbnum)+(AngleBetween( dbLimbAngleZ(BoneObjects[en],bones[en][a].limbnum),(((btt)*dbSin(btt))+(btt*dbCos(btt)))*dbSin(att)))/(13.0) );//+(dbRnd(32)/4.0)
/*if(ty>13)
{
dbText(500,300,dbStr(dbCheckLimbLink(BoneObjects[en],bones[en][a].limbnum)));
}
if(dbLimbAngleY(BoneObjects[en],bones[en][a].limbnum)>13 || dbLimbAngleZ(BoneObjects[en],bones[en][a].limbnum)>13 )
{
dbRotateLimb(BoneObjects[en],bones[en][a].limbnum,0,ty,zy);
}*/
if(!bones[en][a].collision)
{
coll=SC_GroupCollision(bones[en][a].objnum,4);
if(coll>0)
{ fen=Fen(coll);
b=Flimb(fen,coll);
if(BoneObjects[fen]!=BoneObjects[en])
{
dbRotateLimb(BoneObjects[en],bones[en][a].limbnum,0,ty,zy);
}
}
}
}//ObjectInScreen?
} //limb Object exists?
a=a+1;
}while(a<39 && bones[en][a].length>0);
}else{int a=0;do{dbPositionObject(bones[en][a].objnum,0,-5000,0);a=a+1;}while(a<13);}
}// then Object exist?
}//end for
dbSetTextSize(13);
aim=false;
}//endfunction
Because I want help finding the proper value for the variable
Quote: "att"
lol its driving me madd.