RayCast MaximumRange added // Able to shoot in the air

This commit is contained in:
klikev 2024-06-16 13:50:01 +02:00
parent 79c7d841af
commit da9121462f
5 changed files with 77 additions and 3 deletions

View File

@ -31,6 +31,59 @@ Transform:
m_Children: []
m_Father: {fileID: 6798321073873421098}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &6867957792503530889
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7042537997030239891}
- component: {fileID: 7952171964233530059}
m_Layer: 0
m_Name: MaxRayCastRange
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7042537997030239891
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6867957792503530889}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0.9942074, z: -0, w: 0.10747881}
m_LocalPosition: {x: 27.92, y: 0, z: -19.1}
m_LocalScale: {x: 1, y: 100, z: 100}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6798321073873421098}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &7952171964233530059
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6867957792503530889}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 1
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &7971593296632072563
GameObject:
m_ObjectHideFlags: 0
@ -166,6 +219,7 @@ Transform:
m_LocalScale: {x: 0.9699999, y: 0.3, z: 0.31}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 7042537997030239891}
- {fileID: 1313371464610265781}
- {fileID: 2326864918050230340}
m_Father: {fileID: 0}

View File

@ -1366,6 +1366,26 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7042537997030239891, guid: 4d3459d3c81134641b756c0c5205d59e, type: 3}
propertyPath: m_LocalScale.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7042537997030239891, guid: 4d3459d3c81134641b756c0c5205d59e, type: 3}
propertyPath: m_LocalScale.y
value: 100
objectReference: {fileID: 0}
- target: {fileID: 7042537997030239891, guid: 4d3459d3c81134641b756c0c5205d59e, type: 3}
propertyPath: m_LocalScale.z
value: 100
objectReference: {fileID: 0}
- target: {fileID: 7952171964233530059, guid: 4d3459d3c81134641b756c0c5205d59e, type: 3}
propertyPath: m_IsTrigger
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7952171964233530059, guid: 4d3459d3c81134641b756c0c5205d59e, type: 3}
propertyPath: m_ProvidesContacts
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8363807481264483936, guid: 4d3459d3c81134641b756c0c5205d59e, type: 3}
propertyPath: m_Name
value: Gun

View File

@ -2,7 +2,7 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BulletMoving : MonoBehaviour
public class BulletScript : MonoBehaviour
{
public DataBullet dataBullet;
@ -40,7 +40,7 @@ public class BulletMoving : MonoBehaviour
// Update is called once per frame
void Update()
{
rb.velocity = direction * dataBullet.speed;
rb.velocity = direction.normalized * dataBullet.speed;
die(lifetime);
time += Time.deltaTime;
}

View File

@ -13,5 +13,5 @@ MonoBehaviour:
m_Name: DataBullet
m_EditorClassIdentifier:
damage: 10
speed: 5
speed: 10
ammo: 4