How to make a follow camera code and jump sistem
I need help to make a jump sistem (jump with click, no cumulative jumps) and to make the camera follow the player:
I don't know any jump code and I new at C#
Camera code:
using UnityEngine;
using System.Collections;
public class camera : MonoBehaviour {
public GameObject player;
private Vector3 offset;
void Start ()
{
offset = transform.position - player.transform.position;
}
void lateUpdate ()
{
transform.position = player.transform.position + offset;
}
}
Comment
Best Answer
Answer by cailir · Jun 17, 2017 at 04:51 PM
I have made this camera moviment sistem: (Atach a Rigdbody2D to the camera) (Can be used as Player moviment sistem!)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Camera1 : MonoBehaviour {
private Rigidbody2D PlayerRB;
public float Velocidade;
// Use this for initialization
void Start () {
PlayerRB = GetComponent<Rigidbody2D> ();
}
// Update is called once per frame
void Update () {
PlayerRB.velocity = new Vector2 (Velocidade, PlayerRB.velocity.y);
}
}
Your answer
Follow this Question
Related Questions
I want to spawn objects probabilistically. 0 Answers
Can't change an object Layers at runtime via c# code (Help Please) 0 Answers
Spawn and drag on spawn multiple objects with android multiouch 0 Answers
Getting trouble in migrating the Unity IAP old version to new version of IAP in existing project 0 Answers