اذهب إلى المحتوى

Drox Yf

الأعضاء
  • المساهمات

    8
  • تاريخ الانضمام

  • تاريخ آخر زيارة

إنجازات Drox Yf

عضو مبتدئ

عضو مبتدئ (1/3)

2

السمعة بالموقع

  1. للاسف المشكل مازال مستمرا ولكن علمت ما سبب هده لحركة فعندما اضيف add component rigidbody يحدث هدا لمشكل
  2. شكرا على المساعدة - اريد ان اعرف ما سبب المشكل الذي في الفيديو و الحل ادا امكن ساشرح لك المشكل قليلا عندما اضغط عل الجويستيك فقط ضغطة يقوم اللاعب بحركة غير طبيعية كما موضح في الفيديو ولم اعرف من اين المشكل هل من كود الحركة او الريجيدبودي او كود ازرار التحكم
  3. ها هو المشكل الذي يقابلني واد لاحظت ايضا فانميشن حركة الشخصية يعمل حتى ولو الشخصية متوقفة و شكرا مقدما على مساعدتك Try MobileGames - DemoDay - Android - Unity 2021.3.21f1 Personal _DX11_ 2023-03-25 02-30-35.mp4
  4. using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMovement : MonoBehaviour { public float MoveSpeed = 3f; public float smoothRotationTime = 0.12f; public bool enableMobileInputs = false; float currentVelocity; float currentSpeed; float speedVelocity; Transform cameraTransform; private Animator ch_animator; public FixedJoystick joystick; void Start() { cameraTransform = Camera.main.transform; ch_animator = GetComponent<Animator>(); } void Update() { Vector2 input = Vector2.zero; if (enableMobileInputs) { input = new Vector2(joystick.input.x, joystick.input.y); ch_animator.SetBool("Walk", true); } else { input = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")); ch_animator.SetBool("Walk", false); } Vector2 inputDir = input.normalized; if (inputDir != Vector2.zero) { float rotation = Mathf.Atan2(inputDir.x, inputDir.y) * Mathf.Rad2Deg+ cameraTransform.eulerAngles.y; transform.eulerAngles = Vector3.up *Mathf.SmoothDampAngle(transform.eulerAngles.y,rotation, ref currentVelocity, smoothRotationTime); } float targetSpeed = MoveSpeed * inputDir.magnitude; currentSpeed = Mathf.SmoothDamp(currentSpeed,targetSpeed,ref speedVelocity, 0.1f); transform.Translate(transform.forward * currentSpeed *Time.deltaTime,Space.World); } } السلام عليكم اريد اضافة Rigidbodyالى هدا الكود المشكل الدي لدي هو انه عندما احرك joystick قليلا يتحرك اللاعب بسرعة الى خارج الماب علما انني ابرمج لعبة على اليونتي للهاتف
  5. في اليونتي : Assets\Scripts\CameraMove.cs(26,41): error CS1061: 'object' does not contain a definition for 'x' and no accessible extension method 'x' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) ssets\Scripts\CameraMove.cs(27,41): error CS1061: 'object' does not contain a definition for 'y' and no accessible extension method 'y' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) في الفيجيوال ستوديو كود: object' does not contain a definition for 'x' and no accessible extension method 'x' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) [Assembly-CSharp]csharp(CS1061) ssets\Scripts\CameraMove.cs(27,41): error CS1061: 'object' does not contain a definition for 'y' and no accessible extension method 'y' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) هدا هو الخطا الدي يظهر لي
  6. using System.Collections; using System.Collections.Generic; using UnityEngine; public class CameraMove : MonoBehaviour { public float Yaxis; public float Xaxis; public float RotationSensitivity = 8f; public Transform target; float RotationMin = -40; float RotationMax = 80f; float smoothTime = 0.12f; Vector3 targetRotation; Vector3 currentVel; public bool enableMobileInputs = false; public FixedTouchField touchField; void LateUpdate() { if (enableMobileInputs) { Yaxis += touchField.TouchDist.x * RotationSensitivity; Xaxis -= touchField.TouchDist.y * RotationSensitivity; } else { Yaxis += Input.GetAxis("Mouse X")* RotationSensitivity; Xaxis -= Input.GetAxis("Mouse Y")* RotationSensitivity; } Xaxis = Mathf.Clamp(Xaxis, RotationMin, RotationMax); targetRotation = Vector3.SmoothDamp(targetRotation, new Vector3(Xaxis, Yaxis), ref currentVel, smoothTime); transform.eulerAngles = targetRotation; transform.position = target.position - transform.forward * 2f; } } انا ابرمج هدا الكود بلغة #c و كنت اتبع فيديو وعندما وصلت لل TouchDist.x و TouchDist.y ارى ان هناك خطا ولا اعرف لمادا اتمنى ان يساعدني احد ما
×
×
  • أضف...