(Solved) : Want Map Unity3d Try Build Script Let Object Arrow Move Camera Follow Object Script Work Y Q42723068 . . .

We want to do a map in Unity3D. we try to build a script to letthe object(arrow) move and the camera follow the object. But thescript did not work yet and this is our script (Note: the languageused is csharp/ C#)>>>

Object script (arrow):-

using System.Collections;

using UnityEngine;

public class Arrow : MonoBehaviour {

    public float playerSpeed;

    public float sprintSpeed = 4f;

    public float walkSpeed = 2f;

    public float mouseSensitivity = 2f;

    public bool isMoving = false;

    public bool isSprinting = false;

    private float yRot;

    private Animator anim;

    private Rigidbody rigidBody;

    // Use this for initialization

    void Start() {

        playerSpeed =walkSpeed;

        anim =GetComponent<Animator>();

        rigidBody =GetComponent<Rigidbody>();



    // Update is called once per frame

    void Update() {

        yRot +=Input.GetAxis(“Mouse X”) * mouseSensitivity;

        transform.localEulerAngles= new Vector3(transform.localEulerAngles.x, yRot,transform.localEulerAngles.x);

        isMoving =false;

        if(Input.GetAxisRaw(“Horizontal”) > 0.5f ||Input.GetAxisRaw(“Horizontal”) < -0.5f)


            //trasform.Translate(Vector3.forward* Input.GetAxis(“Vertical”) * playerSpeed;

            rigidBody.velocity+= transform.forward * Input.GetAxisRaw(“Vertical”) *playerSpeed;

            isMoving= true;


        if(Input.GetAxisRaw(“Sprint”) > 0f)


            playerSpeed= sprintSpeed;

            isSprinting= true;

        }else if(Input.GetAxisRaw(“Sprint”) < 1f)


            playerSpeed= sprintSpeed;

            isSprinting= false;






Camera script:-

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class CameraFollow : MonoBehaviour {

GameObject playerObj;

// Use this for initialization

void Start () {

playerObj = GameObject.Find(“Arrow”);


// Update is called after Update methods

void Update() {

transform.position = playerObj.transform.position;



Expert Answer

Answer to We want to do a map in Unity3D. we try to build a script to let the object(arrow) move and the camera follow the object….

Leave a Comment


We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us

× How can I help you?