Post by zerochaos98 on Jun 29, 2017 14:50:15 GMT
i wanted to use this in a splitscreen project but i cant get rid f the mouselook function im new to the scripting scene and if someone could help me me by changing it to keyboard input id appreciate that
its from the advanced character movement project (credit to original creator)
OBJ_0 is the CamChase
OBJ_22 Character
OBJ_110 SkinMesh
-----------------------------------------------------------------------------------------------
its from the advanced character movement project (credit to original creator)
OBJ_0 is the CamChase
OBJ_22 Character
OBJ_110 SkinMesh
-----------------------------------------------------------------------------------------------
Quaternion CameraOrientation;
Quaternion CharOrientation;
Vector3 char,cam,dif,temp;
float dist,height;
Quaternion Orientation;
Quaternion Left;
Quaternion Right;
Quaternion Down;
Quaternion Up;
Quaternion UR;
Quaternion UL;
Quaternion DR;
Quaternion DL;
void Main()
{
if (iInitializing())
{
iObjectOrientation(OBJ_22,Orientation);
iMouseLookSet(0,0);
iObjectLocation(OBJ_0,cam);
iObjectLocation(OBJ_110,char);
dif=cam-char;
dist=iVectorLength(dif);
height=3;
}
iQuaternionFromEulerAngles(Left,0,270+iMouseLookY(),0,"xyz");
iQuaternionFromEulerAngles(Right,0,90+iMouseLookY(),0,"xyz");
iQuaternionFromEulerAngles(Down,0,180+iMouseLookY(),0,"xyz");
iQuaternionFromEulerAngles(Up,0,0+iMouseLookY(),0,"xyz");
iQuaternionFromEulerAngles(UR,0,45+iMouseLookY(),0,"xyz");
iQuaternionFromEulerAngles(UL,0,315+iMouseLookY(),0,"xyz");
iQuaternionFromEulerAngles(DR,0,135+iMouseLookY(),0,"xyz");
iQuaternionFromEulerAngles(DL,0,225+iMouseLookY(),0,"xyz");
if (iKeyDown(iKeyCode("DIK_LCONTROL")) && height>1)
{
height-=0.05;
}
if (iKeyDown(iKeyCode("DIK_LSHIFT")) && height<5)
{
height+=0.05;
}
if (iKeyDown(iKeyCode("DIK_RSHIFT")) && dist>2)
{
dist-=0.05;
}
if (iKeyDown(iKeyCode("DIK_RCONTROL")) && dist<8)
{
dist+=0.05;
}
if (iKeyDown(iKeyCode("DIK_A")))
{
iObjectOrientationSet(OBJ_22,Left);
Orientation=Left;
}
if (iKeyDown(iKeyCode("DIK_D")))
{
iObjectOrientationSet(OBJ_22,Right);
Orientation=Right;
}
if (iKeyDown(iKeyCode("DIK_W")))
{
iObjectOrientationSet(OBJ_22,Up);
Orientation=Up;
}
if (iKeyDown(iKeyCode("DIK_S")))
{
iObjectOrientationSet(OBJ_22,Down);
Orientation=Down;
}
if (iKeyDown(iKeyCode("DIK_S")) && iKeyDown(iKeyCode("DIK_D")))
{
iObjectOrientationSet(OBJ_22,DR);
Orientation=DR;
}
if (iKeyDown(iKeyCode("DIK_S")) && iKeyDown(iKeyCode("DIK_A")))
{
iObjectOrientationSet(OBJ_22,DL);
Orientation=DL;
}
if (iKeyDown(iKeyCode("DIK_W")) && iKeyDown(iKeyCode("DIK_A")))
{
iObjectOrientationSet(OBJ_22,UL);
Orientation=UL;
}
if (iKeyDown(iKeyCode("DIK_W")) && iKeyDown(iKeyCode("DIK_D")))
{
iObjectOrientationSet(OBJ_22,UR);
Orientation=UR;
}
if (iKeyDown(iKeyCode("DIK_S")) || iKeyDown(iKeyCode("DIK_W")) || iKeyDown(iKeyCode("DIK_A")) || iKeyDown(iKeyCode("DIK_D")))
{
OUT_24=1;
}
else
{
OUT_24=0;
}
iObjectLocation(OBJ_110,char);
iMouseLookYRangeSet(30,-30);
temp.x=dist*iFloatSin(-iMouseLookY());
temp.y=height;
temp.z=-(dist*iFloatCos(iMouseLookY()));
iObjectLocationSet(OBJ_0,char+temp);
iQuaternionFromEulerAngles(CameraOrientation,iMouseLookX(),iMouseLookY(),0,"xyz");
iObjectLocation(OBJ_0,cam);
iObjectOrientationSet(OBJ_0,CameraOrientation);
iObjectOrientationSet(OBJ_22,Orientation);
}