Saturday, September 16, 2023
HomeSample Page

Sample Page Title


I’ve a prefab named Spear.

It comprises a script like this:

utilizing System.Collections.Generic;
utilizing UnityEngine;

public class PickUp : MonoBehaviour
{
    public GameObject Hand;
    public float WeaponDamage;
    public Enemy enemyScr;
    public bool IsInHand;

    public void Start()
    {
        enemyScr = GameObject.Find("EvilTriangle").GetComponent<Enemy>();

        Hand = GameObject.Find("Hand");
    }

    public void OnMouseDown()
    {
        this.remodel.place = Hand.remodel.place;
        this.remodel.father or mother = GameObject.Find("Hand").remodel;
        remodel.eulerAngles = new Vector3(0, 0, 0);
        GetComponent<Rigidbody2D>().isKinematic = true;
        IsInHand = true;
    }

    public void Update()
    {
        if (Input.GetKeyDown(KeyCode.Q) && IsInHand == true)
        {
            this.remodel.father or mother = null;
            GetComponent<Rigidbody2D>().isKinematic = false;
            IsInHand = false;
        }
    }
}

In play mode, after I click on on the spear (and it’s vertical within the scene), every little thing is trying nice.

But after I click on on the spear when it’s horizontal, (and as you possibly can see within the script, I’m making an attempt to rotate it to 0), its scale is getting bizarre.

Normal trying spear:
enter image description here

Weird trying spear:
enter image description here

This occurs each time I drop the spear vertical (whereas enjoying), it will get thinner and thinner.

I do not know what’s inflicting this downside.

Any assist shall be appreciated!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments