Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 14e9a04

Browse files
Merge pull request #44 from pkunjam/master
Added script for smooth movement of a gameobject
2 parents 4e92323 + 7836593 commit 14e9a04

File tree

80 files changed

+750
-1433
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+750
-1433
lines changed

‎Assets/Scenes/ui animation Sample Scene.unity.meta‎

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Assets/Scripts/AssetBundles/AssetBundleLoader.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ IEnumerator DownloadAndCache(string bundleURL, string assetName = "")
8484
}
8585

8686
// now download the actual bundle, with hashString parameter it uses cached version if available
87-
www = UnityWebRequest.GetAssetBundle(bundleURL + "?r=" + (Random.value * 9999999), hashString, 0);
87+
www = UnityWebRequestAssetBundle.GetAssetBundle(bundleURL + "?r=" + (Random.value * 9999999), hashString, 0);
8888

8989
// wait for load to finish
90-
yield return www.Send();
90+
yield return www.SendWebRequest();
9191

9292
if (www.error != null)
9393
{

‎Assets/Scripts/Camera/MarrtsSmoothedMouseLook.cs.meta‎

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using UnityEngine;
2+
using System.Collections.Generic;
3+
using System.Collections;
4+
5+
//Script for moving a gameObject smoothly
6+
//Usage: Attach the character controller component to the gameobject that you want to move
7+
8+
namespace UnityLibary
9+
{
10+
public class PlayerMovement : MonoBehaviour
11+
{
12+
// place the gameobject that you want to move to the controller placeholder
13+
public CharacterController controller;
14+
15+
public float speed = 5f;
16+
17+
void Update()
18+
{
19+
float x = Input.GetAxis("Horizontal");
20+
float z = Input.GetAxis("Vertical");
21+
22+
Vector3 move = transform.right * x + transform.forward * z;
23+
24+
controller.Move(move * speed * Time.deltaTime);
25+
26+
//Rotate clockwise
27+
if (Input.GetKey(KeyCode.E))
28+
{
29+
transform.RotateAround(transform.position, Vector3.up, 100 * Time.deltaTime);
30+
}
31+
32+
// Rotate anticlockwise
33+
if (Input.GetKey(KeyCode.Q))
34+
{
35+
transform.RotateAround(transform.position, -Vector3.up, 100 * Time.deltaTime);
36+
}
37+
38+
}
39+
40+
}
41+
}

‎Assets/Scripts/Camera/PlayerMovement.cs.meta‎

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Assets/Editor.meta‎ renamed to ‎Assets/Scripts/Docs/Mesh.meta‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Assets/Scripts/Docs/Mesh/MeshExample.cs.meta‎

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Assets/Scripts/Docs/UnityEngine/CullingGroupExample.cs.meta‎

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Assets/Scripts/Editor/ContextMenu.meta‎

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Assets/Scripts/Editor/ContextMenu/BoxColliderFitChildren.cs.meta‎

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /