Cleanup & bugfix

This commit is contained in:
Ignis 2021-08-23 17:30:04 +02:00
parent 0c5d5bbe59
commit c1d4536d0f
5 changed files with 62 additions and 9 deletions

View file

@ -156,7 +156,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ec5d582fdf544e84d8dff955464dd912, type: 3} m_Script: {fileID: 11500000, guid: ec5d582fdf544e84d8dff955464dd912, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
moveSpeed: 1 moveSpeed: 7.5
turnSpeed: 5
--- !u!54 &327492103 --- !u!54 &327492103
Rigidbody: Rigidbody:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -171,7 +172,7 @@ Rigidbody:
m_UseGravity: 1 m_UseGravity: 1
m_IsKinematic: 0 m_IsKinematic: 0
m_Interpolate: 0 m_Interpolate: 0
m_Constraints: 0 m_Constraints: 112
m_CollisionDetection: 0 m_CollisionDetection: 0
--- !u!23 &327492104 --- !u!23 &327492104
MeshRenderer: MeshRenderer:

View file

@ -17,13 +17,8 @@ public class Dobber : MonoBehaviour
void Awake() void Awake()
{ {
//i don't know why dose need to reference it's self but it's requiered to work
playerControls = new PlayerControls(); playerControls = new PlayerControls();
//automatically find rigidbody in character
rb = gameObject.GetComponent<Rigidbody>(); rb = gameObject.GetComponent<Rigidbody>();
//lock rotation of the rigidbody
rb.constraints = RigidbodyConstraints.FreezeRotationZ | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationX;
//here we enable controlls for Dobber character
playerControls.DobberControls.Enable(); playerControls.DobberControls.Enable();
} }
@ -52,8 +47,8 @@ public class Dobber : MonoBehaviour
void Move() void Move()
{ {
//new Vector3 for calculating movement values //new Vector3 for calculating movement values
Vector3 move = new Vector3(0, 0, moveVertical * 100 * moveSpeed * Time.deltaTime); Vector3 move = new Vector3(0, 0, moveVertical * moveSpeed);
Quaternion rotate = Quaternion.Euler(transform.rotation.x, moveHorizontal * 100 * turnSpeed * Time.deltaTime, transform.rotation.z); Quaternion rotate = Quaternion.Euler(transform.rotation.x, moveHorizontal * turnSpeed , transform.rotation.z);
//here we apply the movement related to the rotation of player //here we apply the movement related to the rotation of player
rb.velocity = transform.right * move.x + transform.up * move.y + transform.forward * move.z; rb.velocity = transform.right * move.x + transform.up * move.y + transform.forward * move.z;
gameObject.transform.rotation = transform.rotation * rotate; gameObject.transform.rotation = transform.rotation * rotate;

View file

@ -10,6 +10,7 @@
"com.unity.test-framework": "1.1.27", "com.unity.test-framework": "1.1.27",
"com.unity.textmeshpro": "3.0.6", "com.unity.textmeshpro": "3.0.6",
"com.unity.timeline": "1.4.8", "com.unity.timeline": "1.4.8",
"com.unity.toolchain.win-x86_64-linux-x86_64": "0.1.21-preview",
"com.unity.ugui": "1.0.0", "com.unity.ugui": "1.0.0",
"com.unity.modules.ai": "1.0.0", "com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0", "com.unity.modules.androidjni": "1.0.0",

View file

@ -106,6 +106,22 @@
}, },
"url": "https://packages.unity.com" "url": "https://packages.unity.com"
}, },
"com.unity.sysroot": {
"version": "0.1.19-preview",
"depth": 1,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.sysroot.linux-x86_64": {
"version": "0.1.14-preview",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.sysroot": "0.1.18-preview"
},
"url": "https://packages.unity.com"
},
"com.unity.test-framework": { "com.unity.test-framework": {
"version": "1.1.27", "version": "1.1.27",
"depth": 0, "depth": 0,
@ -138,6 +154,16 @@
}, },
"url": "https://packages.unity.com" "url": "https://packages.unity.com"
}, },
"com.unity.toolchain.win-x86_64-linux-x86_64": {
"version": "0.1.21-preview",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.sysroot": "0.1.19-preview",
"com.unity.sysroot.linux-x86_64": "0.1.14-preview"
},
"url": "https://packages.unity.com"
},
"com.unity.ugui": { "com.unity.ugui": {
"version": "1.0.0", "version": "1.0.0",
"depth": 0, "depth": 0,

View file

@ -32,6 +32,36 @@
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "lightmapping.autoUnwrapLightmapUV", "key": "lightmapping.autoUnwrapLightmapUV",
"value": "{\"m_Value\":true}" "value": "{\"m_Value\":true}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "editor.backFaceSelectEnabled",
"value": "{\"m_Value\":false}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "editor.toolbarIconGUI",
"value": "{\"m_Value\":false}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "editor.showSceneInfo",
"value": "{\"m_Value\":false}"
},
{
"type": "UnityEngine.ProBuilder.SelectionModifierBehavior, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "editor.rectSelectModifier",
"value": "{\"m_Value\":2}"
},
{
"type": "UnityEngine.ProBuilder.RectSelectMode, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "editor.dragSelectRectMode",
"value": "{\"m_Value\":0}"
},
{
"type": "UnityEngine.ProBuilder.SelectMode, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "editor.selectMode",
"value": "{\"m_Value\":1}"
} }
] ]
} }