GUN BE THROW
This commit is contained in:
@@ -20,8 +20,7 @@ Material:
|
|||||||
m_DoubleSidedGI: 0
|
m_DoubleSidedGI: 0
|
||||||
m_CustomRenderQueue: -1
|
m_CustomRenderQueue: -1
|
||||||
stringTagMap: {}
|
stringTagMap: {}
|
||||||
disabledShaderPasses:
|
disabledShaderPasses: []
|
||||||
- MOTIONVECTORS
|
|
||||||
m_LockedProperties:
|
m_LockedProperties:
|
||||||
m_SavedProperties:
|
m_SavedProperties:
|
||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ GameObject:
|
|||||||
- component: {fileID: 3900353858553251828}
|
- component: {fileID: 3900353858553251828}
|
||||||
- component: {fileID: 2064409223717511053}
|
- component: {fileID: 2064409223717511053}
|
||||||
- component: {fileID: 7066644236778025839}
|
- component: {fileID: 7066644236778025839}
|
||||||
|
- component: {fileID: 6393509116105302420}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: ThrownGun
|
m_Name: ThrownGun
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -126,5 +127,37 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: fe870c030a2b648d89c63559e7522299, type: 3}
|
m_Script: {fileID: 11500000, guid: fe870c030a2b648d89c63559e7522299, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier: Assembly-CSharp::GunThrown
|
m_EditorClassIdentifier: Assembly-CSharp::GunThrown
|
||||||
|
rb: {fileID: 6393509116105302420}
|
||||||
player: {fileID: 0}
|
player: {fileID: 0}
|
||||||
TargetPosition: {x: 0, y: 0, z: 0}
|
TargetPosition: {x: 0, y: 0, z: 0}
|
||||||
|
currentRotation: {x: 0, y: 0, z: 0}
|
||||||
|
targetRotation: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
isStuck: 0
|
||||||
|
despawnTimer: 10
|
||||||
|
--- !u!54 &6393509116105302420
|
||||||
|
Rigidbody:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6611039685471789196}
|
||||||
|
serializedVersion: 5
|
||||||
|
m_Mass: 1
|
||||||
|
m_LinearDamping: 0
|
||||||
|
m_AngularDamping: 0.05
|
||||||
|
m_CenterOfMass: {x: 0, y: 0, z: 0}
|
||||||
|
m_InertiaTensor: {x: 1, y: 1, z: 1}
|
||||||
|
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_IncludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ExcludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ImplicitCom: 1
|
||||||
|
m_ImplicitTensor: 1
|
||||||
|
m_UseGravity: 1
|
||||||
|
m_IsKinematic: 0
|
||||||
|
m_Interpolate: 0
|
||||||
|
m_Constraints: 0
|
||||||
|
m_CollisionDetection: 1
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class GunThrown : MonoBehaviour
|
public class GunThrown : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
public Rigidbody rb;
|
||||||
public GameObject player;
|
public GameObject player;
|
||||||
public Vector3 TargetPosition;
|
public Vector3 TargetPosition;
|
||||||
|
public float playerDistance;
|
||||||
|
|
||||||
public Vector3 targetDirection;
|
public Vector3 currentRotation;
|
||||||
public Quaternion targetRotation;
|
public Quaternion targetRotation;
|
||||||
|
|
||||||
public bool isStuck;
|
public bool isStuck;
|
||||||
@@ -16,13 +18,30 @@ public class GunThrown : MonoBehaviour
|
|||||||
player = GameObject.Find("Player");
|
player = GameObject.Find("Player");
|
||||||
TargetPosition = player.transform.position;
|
TargetPosition = player.transform.position;
|
||||||
transform.LookAt(player.transform.position);
|
transform.LookAt(player.transform.position);
|
||||||
|
currentRotation = transform.eulerAngles;
|
||||||
|
transform.eulerAngles = new Vector3(60, currentRotation.y, currentRotation.z);
|
||||||
|
|
||||||
|
playerDistance = Vector3.Distance(transform.position, TargetPosition);
|
||||||
|
if (playerDistance < 9)
|
||||||
|
{
|
||||||
|
playerDistance = playerDistance * 1.2f;
|
||||||
|
}
|
||||||
|
if (playerDistance > 16)
|
||||||
|
{
|
||||||
|
playerDistance = playerDistance / 1.4f;
|
||||||
|
}
|
||||||
|
else if (playerDistance > 13)
|
||||||
|
{
|
||||||
|
playerDistance = playerDistance / 1.2f;
|
||||||
|
}
|
||||||
|
rb.AddForce(transform.up * playerDistance, ForceMode.Impulse);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
//transform.position = Vector3.MoveTowards(transform.position, TargetPosition, 10 * Time.deltaTime);
|
||||||
|
|
||||||
transform.position = Vector3.MoveTowards(transform.position, TargetPosition, 10 * Time.deltaTime);
|
|
||||||
|
|
||||||
if (transform.position == TargetPosition)
|
if (transform.position == TargetPosition)
|
||||||
{
|
{
|
||||||
|
|||||||
110
Assets/models/suyfgdsigdsug.fbx.meta
Normal file
110
Assets/models/suyfgdsigdsug.fbx.meta
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c6075395625eb49c4bafb0ef86f449eb
|
||||||
|
ModelImporter:
|
||||||
|
serializedVersion: 24200
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
materials:
|
||||||
|
materialImportMode: 2
|
||||||
|
materialName: 0
|
||||||
|
materialSearch: 1
|
||||||
|
materialLocation: 1
|
||||||
|
animations:
|
||||||
|
legacyGenerateAnimations: 4
|
||||||
|
bakeSimulation: 0
|
||||||
|
resampleCurves: 1
|
||||||
|
optimizeGameObjects: 0
|
||||||
|
removeConstantScaleCurves: 0
|
||||||
|
motionNodeName:
|
||||||
|
animationImportErrors:
|
||||||
|
animationImportWarnings:
|
||||||
|
animationRetargetingWarnings:
|
||||||
|
animationDoRetargetingWarnings: 0
|
||||||
|
importAnimatedCustomProperties: 0
|
||||||
|
importConstraints: 0
|
||||||
|
animationCompression: 1
|
||||||
|
animationRotationError: 0.5
|
||||||
|
animationPositionError: 0.5
|
||||||
|
animationScaleError: 0.5
|
||||||
|
animationWrapMode: 0
|
||||||
|
extraExposedTransformPaths: []
|
||||||
|
extraUserProperties: []
|
||||||
|
clipAnimations: []
|
||||||
|
isReadable: 0
|
||||||
|
meshes:
|
||||||
|
lODScreenPercentages: []
|
||||||
|
globalScale: 1
|
||||||
|
meshCompression: 0
|
||||||
|
addColliders: 0
|
||||||
|
useSRGBMaterialColor: 1
|
||||||
|
sortHierarchyByName: 1
|
||||||
|
importPhysicalCameras: 1
|
||||||
|
importVisibility: 1
|
||||||
|
importBlendShapes: 1
|
||||||
|
importCameras: 1
|
||||||
|
importLights: 1
|
||||||
|
nodeNameCollisionStrategy: 1
|
||||||
|
fileIdsGeneration: 2
|
||||||
|
swapUVChannels: 0
|
||||||
|
generateSecondaryUV: 0
|
||||||
|
useFileUnits: 1
|
||||||
|
keepQuads: 0
|
||||||
|
weldVertices: 1
|
||||||
|
bakeAxisConversion: 0
|
||||||
|
preserveHierarchy: 0
|
||||||
|
skinWeightsMode: 0
|
||||||
|
maxBonesPerVertex: 4
|
||||||
|
minBoneWeight: 0.001
|
||||||
|
optimizeBones: 1
|
||||||
|
generateMeshLods: 0
|
||||||
|
meshLodGenerationFlags: 0
|
||||||
|
maximumMeshLod: -1
|
||||||
|
meshOptimizationFlags: -1
|
||||||
|
indexFormat: 0
|
||||||
|
secondaryUVAngleDistortion: 8
|
||||||
|
secondaryUVAreaDistortion: 15.000001
|
||||||
|
secondaryUVHardAngle: 88
|
||||||
|
secondaryUVMarginMethod: 1
|
||||||
|
secondaryUVMinLightmapResolution: 40
|
||||||
|
secondaryUVMinObjectScale: 1
|
||||||
|
secondaryUVPackMargin: 4
|
||||||
|
useFileScale: 1
|
||||||
|
strictVertexDataChecks: 0
|
||||||
|
tangentSpace:
|
||||||
|
normalSmoothAngle: 60
|
||||||
|
normalImportMode: 0
|
||||||
|
tangentImportMode: 3
|
||||||
|
normalCalculationMode: 4
|
||||||
|
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
|
||||||
|
blendShapeNormalImportMode: 1
|
||||||
|
normalSmoothingSource: 0
|
||||||
|
referencedClips: []
|
||||||
|
importAnimation: 1
|
||||||
|
humanDescription:
|
||||||
|
serializedVersion: 3
|
||||||
|
human: []
|
||||||
|
skeleton: []
|
||||||
|
armTwist: 0.5
|
||||||
|
foreArmTwist: 0.5
|
||||||
|
upperLegTwist: 0.5
|
||||||
|
legTwist: 0.5
|
||||||
|
armStretch: 0.05
|
||||||
|
legStretch: 0.05
|
||||||
|
feetSpacing: 0
|
||||||
|
globalScale: 1
|
||||||
|
rootMotionBoneName:
|
||||||
|
hasTranslationDoF: 0
|
||||||
|
hasExtraRoot: 0
|
||||||
|
skeletonHasParents: 1
|
||||||
|
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
||||||
|
autoGenerateAvatarMappingIfUnspecified: 1
|
||||||
|
animationType: 2
|
||||||
|
humanoidOversampling: 1
|
||||||
|
avatarSetup: 0
|
||||||
|
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
|
||||||
|
importBlendShapeDeformPercent: 1
|
||||||
|
remapMaterialsIfMaterialImportModeIsNone: 0
|
||||||
|
additionalBone: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Reference in New Issue
Block a user