I'm not very good at scripting and for a while now i have been trying to edit this script so that the 1st person camera is stuck to a car:
-i need to be able to look around with the Camera but drive the car
-The camera needs to be attached to the car so that if i drive forward the camera goes with it
if anyone has a script that can do this or can tell me what to do it will be very helpful.
Quote
//This script keeps a SkinMesh object locked
//at a given offset from the camera.
//This technique can be used in a FPS game, to
//render view-locked 3d props, like a carried gun.
//Link this script object to the CamChase object
//and the SkinMesh object.
//Do NOT link the CamChase and the SkinMesh in the Object List!
//In this script, make sure that:
// OBJ_0 is the CamChase object
// OBJ_3 is the SkinMesh object
Quaternion DeltaOrientation;
Vector3 DeltaLocation;
void Main()
{
Quaternion cameraOrientation;
Vector3 cameraLocation;
Quaternion orientation;
Vector3 location;
if (iInitializing())
{
//Set locked SkinMesh orientation (camera relative)
iQuaternionFromEulerAngles(DeltaOrientation,-2,0,0,"xyz");
//Set locked SkinMesh location (camera relative)
DeltaLocation = Vector3(0.1,-0.15,0.2);
}
iObjectOrientation(OBJ_22,cameraOrientation);
iObjectLocation(OBJ_22,cameraLocation);
Quaternion objectOrientation;
Vector3 objectLocation;
iQuaternionMultiply(objectOrientation,DeltaOrientation,cameraOrientation);
iVectorRotate(objectLocation,DeltaLocation,cameraOrientation);
objectLocation += cameraLocation;
iObjectOrientationSet(OBJ_0,objectOrientation);
iObjectLocationSet(OBJ_0,objectLocation);
}
-i need to be able to look around with the Camera but drive the car
-The camera needs to be attached to the car so that if i drive forward the camera goes with it
if anyone has a script that can do this or can tell me what to do it will be very helpful.