New collision script in 3D
This commit is contained in:
@@ -38,7 +38,7 @@ RenderSettings:
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0.44657844, g: 0.49641222, b: 0.5748171, a: 1}
|
||||
m_IndirectSpecularColor: {r: 0.44657826, g: 0.49641263, b: 0.57481676, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
@@ -311,6 +311,7 @@ GameObject:
|
||||
- component: {fileID: 915004378}
|
||||
- component: {fileID: 915004377}
|
||||
- component: {fileID: 915004376}
|
||||
- component: {fileID: 915004380}
|
||||
- component: {fileID: 915004375}
|
||||
- component: {fileID: 915004374}
|
||||
m_Layer: 0
|
||||
@@ -350,6 +351,8 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
movespeed: 30
|
||||
rb: {fileID: 915004374}
|
||||
movement: {x: 0, y: 0, z: 0}
|
||||
rotation: {x: 0, y: 0, z: 0}
|
||||
--- !u!65 &915004376
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -426,6 +429,19 @@ Transform:
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &915004380
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 915004373}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ac60c4a928e1042438bc00bd2f70af0a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
playerMovement: {fileID: 915004375}
|
||||
--- !u!1001 &2271212633275908120
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -433,6 +449,10 @@ PrefabInstance:
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 910729301209537742, guid: 97fd77a6e795be94a94adfb881cd3bf3, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Wall
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 910729301209537742, guid: 97fd77a6e795be94a94adfb881cd3bf3, type: 3}
|
||||
propertyPath: m_StaticEditorFlags
|
||||
value: 4294967295
|
||||
@@ -497,6 +517,22 @@ PrefabInstance:
|
||||
propertyPath: m_Materials.Array.data[0]
|
||||
value:
|
||||
objectReference: {fileID: 2100000, guid: 61342213f6e6d324687a7eb2fbceba8f, type: 2}
|
||||
- target: {fileID: 3790315201501330483, guid: 97fd77a6e795be94a94adfb881cd3bf3, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3790315201501330483, guid: 97fd77a6e795be94a94adfb881cd3bf3, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 10
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3790315201501330483, guid: 97fd77a6e795be94a94adfb881cd3bf3, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -0.007
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4854014205894733483, guid: 97fd77a6e795be94a94adfb881cd3bf3, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Wall
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4854014205894733483, guid: 97fd77a6e795be94a94adfb881cd3bf3, type: 3}
|
||||
propertyPath: m_StaticEditorFlags
|
||||
value: 4294967295
|
||||
@@ -509,6 +545,10 @@ PrefabInstance:
|
||||
propertyPath: m_IsTrigger
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5348579737150834501, guid: 97fd77a6e795be94a94adfb881cd3bf3, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Wall
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5348579737150834501, guid: 97fd77a6e795be94a94adfb881cd3bf3, type: 3}
|
||||
propertyPath: m_StaticEditorFlags
|
||||
value: 4294967295
|
||||
@@ -517,6 +557,10 @@ PrefabInstance:
|
||||
propertyPath: m_IsTrigger
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6593650467854633358, guid: 97fd77a6e795be94a94adfb881cd3bf3, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Wall
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6593650467854633358, guid: 97fd77a6e795be94a94adfb881cd3bf3, type: 3}
|
||||
propertyPath: m_StaticEditorFlags
|
||||
value: 4294967295
|
||||
|
||||
15
3D/Assets/Scripts/PlayerCollision.cs
Normal file
15
3D/Assets/Scripts/PlayerCollision.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerCollision : MonoBehaviour
|
||||
{
|
||||
public PlayerMovement3d playerMovement;
|
||||
|
||||
private void OnCollisionEnter(Collision collision) {
|
||||
if(collision.collider.name == "Wall") {
|
||||
Debug.Log("Wall hit");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
11
3D/Assets/Scripts/PlayerCollision.cs.meta
Normal file
11
3D/Assets/Scripts/PlayerCollision.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ac60c4a928e1042438bc00bd2f70af0a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -7,8 +7,8 @@ public class PlayerMovement3d : MonoBehaviour
|
||||
public float movespeed = 15f;
|
||||
|
||||
public Rigidbody rb;
|
||||
Vector3 movement;
|
||||
Vector3 rotation;
|
||||
public Vector3 movement;
|
||||
public Vector3 rotation;
|
||||
private float x, y;
|
||||
|
||||
void Update() {
|
||||
|
||||
Reference in New Issue
Block a user