Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi, I am creating a game in Unity 5. I\'m stuck while creating the Survival Shoo

ID: 3665592 • Letter: H

Question

Hi,

I am creating a game in Unity 5. I'm stuck while creating the Survival Shooter Tutorial game.

I am creating the player character. See link video below.

http://unity3d.com/learn/tutorials/projects/survival-shooter/player-character?playlist=17144

(When I started a new project prior, the death, ideal, move any state was precostimized for me, but why is it not this time around?)

How do I get it precostomized or how do I create a larso transition from idle to move and move to idle on a mac?

WHy did any state and entry populated this time around and not the others?

Help with steps....and show pic...

Explanation / Answer

public class PlayerMovement : MonoBehaviour

{

public float speed =6f;

Vector3 movement;

Animator anim;

Rigidbody playerRigidbody;

int floorMask;

float camRayLength = 100f;

void Awake()

{

floorMask = LayerMask.GetMask ("Floor");

anim = GetComponent <Animator> ();

playerRigidbody = GetComponent <Rigidbody> ();

}

void FixedUpdate()

{

float h = Input.GetAxisRaw ("Horizontal");

float v = Input.GetAxisRaw ("Vertical");

Move (h, v);

Turning ();

Animating (h, v);

}

void Move (float h, float v)

{

movement.Set (h, 0f, v);

movement = movement.normalized * speed * Time.deltaTime;

playerRigidbody.MovePosition (transform.position + movement);

}

void Turning()

{

Ray camRay = Camera.main.ScreenPointToRay (Input.mousePosition);

RaycastHit floorHit;

if (Physics.Raycast (camRay, out floorHit, camRayLenght, floorMask)

{

Vector3 playerToMouse = flootHit.point - transform.position;

playerToMouse.y = 0f;

Quaternion newRotation = Quaternion.LookRotation (playerToMouse);

playerRigidbody.MoveRotation (newRotation);

}

}

void Animating (float h, float v)

{

bool walking = h != 0f || v != 0f;

anim.SetBool ("IsWalking", walking);

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote