«یا اللهُ یا رَبِّ یا حَیُّ یا قَیّوم یا ذَالجَلالِ وَ الاکرام اَسئَلُکَ بِاسمِکَ اَلعَظیم اَلاَعظَم اَن تَرزُقَنی رِزقاً حَلالاً طَیِّباً بِرَحمَتِکَ الواسِعَه یا اَرحَمَ الرّاحِمِین.»
رسم خط در یونیتی با کد سیشارپ :: گیم اور _ بازیسازی با unity + مطالب متفرقه

گیم اور _ بازیسازی با unity + مطالب متفرقه

آموزش های علمی با اجازه ی خدا تقدیم به هرکس خدا بخواد

آموزش های علمی با اجازه ی خدا تقدیم به هرکس خدا بخواد

به نام خدا
--
گروه قدیم ما promakers.ir یا پرومیکرز بود که بالای هزار اموزش توش ساخته بودم به اسم sajjad3011 ولی حیف ادمین سایتش عوض کرد
حالا سوالی بود کاری بود این شمارمه

قدیمیا دلم براتون تنگ شده... فقط معرفی کنید توی پیامک یا تماس یاد بیارید.
اگه جواب ندادم شاید موقعیت نداشته باشم.
بگید توی پیام از بچه های پرومیکرز هستید.

---
سوالی بود بذارید
نظر خصوصی نذارید
پاسخش سخته
دوست داشتید شماره بذارید تو واتساپ یا ایتا یا .... گروه بزنیم.
09358077198

بایگانی
پیوندها

رسم خط در یونیتی با کد سیشارپ

دوشنبه, ۱۱ آبان ۱۳۹۴، ۰۷:۲۲ ق.ظ
منبع:gameover.blog.ir
using UnityEngine;
using System.Collections;

public class DrawLine : MonoBehaviour
{
 //reference to LineRenderer component
 private LineRenderer line; 
 //car to store mouse position on the screen
 private Vector3 mousePos;
 //assign a material to the Line Renderer in the Inspector
 public Material material;
 //number of lines drawn
 private int currLines = 0;

 void Update ()
 {
  //Create new Line on left mouse click(down)
  if(Input.GetMouseButtonDown(0))
  {
   //check if there is no line renderer created
   if(line == null){
    //create the line
    createLine();
   }
   //get the mouse position
   mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
   //set the z co ordinate to 0 as we are only interested in the xy axes
   mousePos.z = 0;
   //set the start point and end point of the line renderer
   line.SetPosition(0,mousePos);
   line.SetPosition(1,mousePos);
  }
  //if line renderer exists and left mouse button is click exited (up)
  else if(Input.GetMouseButtonUp(0) && line)
  {
   mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
   mousePos.z = 0;
   //set the end point of the line renderer to current mouse position
   line.SetPosition(1,mousePos);
   //set line as null once the line is created
   line = null;
   currLines++;
  }
  //if mouse button is held clicked and line exists
  else if(Input.GetMouseButton(0) && line)
  {
   mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
   mousePos.z = 0;
   //set the end position as current position but dont set line as null as the mouse click is not exited
   line.SetPosition(1, mousePos);
  }
 }
 
 //method to create line
 private void createLine()
 {
  //create a new empty gameobject and line renderer component
  line = new GameObject("Line"+currLines).AddComponent<LineRenderer>();
  //assign the material to the line
  line.material =  material;
  //set the number of points to the line
  line.SetVertexCount(2);
  //set the width
  line.SetWidth(0.15f,0.15f);
  //render line to the world origin and not to the object's position
  line.useWorldSpace = true;  

 }
}
منبع اصلی:
http://www.thegamecontriver.com/2015/05/how-to-draw-line-on-screen-in-unity-csharp.html
موافقین ۰ مخالفین ۰ ۹۴/۰۸/۱۱
مدیرکل

نظرات (۲)

سلام.
کارتون عالیه.
فوق العاده اید
همینجوری ادامه بدید.
با تشکر
یا علی مدد
پاسخ:
سلام.
ممنون.درود به شما.
با تشکر از نظر شما دوست عزیز.

سلام

این کدها منسوخ شده

لطفا به روزش کنید

متشکرم

پاسخ:
لپتاپم خرابه
گوگل بزن میاد انگلیسی

ارسال نظر

ارسال نظر آزاد است، اما اگر قبلا در بیان ثبت نام کرده اید می توانید ابتدا وارد شوید.
شما میتوانید از این تگهای html استفاده کنید:
<b> یا <strong>، <em> یا <i>، <u>، <strike> یا <s>، <sup>، <sub>، <blockquote>، <code>، <pre>، <hr>، <br>، <p>، <a href="" title="">، <span style="">، <div align="">
تجدید کد امنیتی