ScratchData LogoScratchData
Back to adude4804's profile

READ

ADadude4804•Created November 3, 2011
READ
0
1
124 views
View on Scratch

Description

:D Heres the script Btw //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,0,0,0,"xyz"); //Set locked SkinMesh location (camera relative) DeltaLocation = Vector3(1,-0.3,1); } iObjectOrientation(OBJ_0,cameraOrientation); iObjectLocation(OBJ_0,cameraLocation); Quaternion objectOrientation; Vector3 objectLocation; iQuaternionMultiply(objectOrientation,DeltaOrientation,cameraOrientation); iVectorRotate(objectLocation,DeltaLocation,cameraOrientation); objectLocation += cameraLocation; iObjectOrientationSet(OBJ_3,objectOrientation); iObjectLocationSet(OBJ_3,objectLocation); }

Project Details

Project ID2122622
CreatedNovember 3, 2011
Last ModifiedNovember 3, 2011
SharedNovember 3, 2011
Visibilityvisible
CommentsAllowed