13 Eylül 2020 Pazar

Unity Nedir? (Üzerinde çalışılıyor....)

 Unity (game engine) - Wikipedia



Neden Unity?


Araştırmalarıma göre büyük bir grubun içinde değilseniz sağlamda bir yazılım geçmişiniz yoksa Unreal Engine sizi biraz kasar deniyor. O nedenle Unity kullanmak ilk etapta kaynağında daha fazla olması nedeniyle daha kritik.


CS kodlarını görüntülemek için Notepad++ veya Sublime kullanabilirsiniz.



Roll a Ball


Tutorildaki ilk eğitim bu. Ben bir türlü topumu hareket ettirememiştim buraya topun ayarlarını atacağım. Dikkatli şekilde incelerseniz. Top kesin hareket eder.






using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEngine.InputSystem;


public class PlayerController : MonoBehaviour

{

    public float speed = 0;

    private Rigidbody rb;

    private float movementX;

    private float movementY;


    // Start is called before the first frame update

    void Start()

    {

        rb = GetComponent<Rigidbody>();

    }


    private void OnMove(InputValue movementValue)

    {

        Vector2 movementVector = movementValue.Get<Vector2>();

        movementX = movementVector.x;

        movementY = movementVector.y;

    }


    private void FixedUpdate()

    {

        Vector3 movement = new Vector3(movementX, 0.0f, movementY);

        rb.AddForce(movement * speed);

    }

}




------------------------------------------------------------------------------------


Camera Script


using System.Collections;

using System.Collections.Generic;

using UnityEngine;


public class Camerascript : MonoBehaviour

{

    public GameObject player;


    private Vector3 offset;


    // Start is called before the first frame update

    void Start()

    {

        offset = transform.position - player.transform.position;

    }


    // Update is called once per frame

    void LateUpdate()

    {

        transform.position = player.transform.position + offset;

    }

}



Player Controller Script



using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEngine.InputSystem;


public class PlayerController : MonoBehaviour

{

    public float speed = 0;


    private Rigidbody rb;


    private float movementX;

    private float movementY;


    // Start is called before the first frame update

    void Start()

    {

        rb = GetComponent<Rigidbody>();

    }


    private void OnMove(InputValue movementValue)

    {

        Vector2 movementVector = movementValue.Get<Vector2>();


        movementX = movementVector.x;

        movementY = movementVector.y;

    }


    private void FixedUpdate()

    {

        Vector3 movement = new Vector3(movementX, 0.0f, movementY);


        rb.AddForce(movement * speed);

    }


}



















Kaynak:  


https://learn.unity.com/tutorial

https://learn.unity.com/courses

https://docs.unity3d.com/ScriptReference/30_search.html?q=Input

https://forum.unity.com/


Ros2 çalışmaları

 1) Her saniye yazı yazdırma. Eklediğim kod öncelikle Hello Cpp Node yazdıracak ardınca Hello ekleyecek. benim .cpp dosyamın adı my_first_no...