JonDevTutorials
JonDevTutorials
  • 5
  • 192 036
ADD ARMS TO YOUR GAME - EASIEST WAY (Unity3D)
Thanks for all the nice comments on my other videos.
If you enjoyed, don't forget to like and subscribe.
Sorry if this video is a bit scuffed, it's long because there isn't any code I can tell you to copy paste and I have to show you every step. Plus I'm too lazy to edit it down to 12 minutes.
มุมมอง: 70 055

วีดีโอ

VAULTING/CLIMB LEDGES UNITY TUTORIAL (FPS)
มุมมอง 20K2 ปีที่แล้ว
This is truly one of the unity tutorials of all time. Simple way of adding arms coming soon (within a week) GITHUB: github.com/JonDevTutorial/LedgeClimbingTut
Random AI Patrolling Tutorial Unity3D
มุมมอง 63K2 ปีที่แล้ว
In this video I will teach you how to make a navmesh agent move around randomly within an area. Code (yes you can use it for whatever you want): github.com/JonDevTutorial/RandomNavMeshMovement
How to Pick Up + Hold Objects in Unity (FPS)
มุมมอง 37K2 ปีที่แล้ว
In this video I show how to pick up, rotate, and throw objects in Unity. CODE (YES YOU HAVE PERMISSION TO USE IT): github.com/JonDevTutorial/PickUpTutorial
How To Set Up A Mixamo Character In Unity
มุมมอง 2.9K2 ปีที่แล้ว
Other Unity tutorials are too long, here is a short one.

ความคิดเห็น

  • @WebbyTheGoat
    @WebbyTheGoat 2 วันที่ผ่านมา

    the ai is falling through the floor

  • @charljustinedarapisa6758
    @charljustinedarapisa6758 3 วันที่ผ่านมา

    Can I use this function to make a random wildfire behaviour? Thank you.

  • @AaronRiggs-b5e
    @AaronRiggs-b5e 10 วันที่ผ่านมา

    This was the best dev video I have ever seen lol short to the point and hilarious. THANK YOU JonDevTutorials!

  • @lityumLi
    @lityumLi 11 วันที่ผ่านมา

    which unity version did you used in this tutorial

  • @CobusGreyling
    @CobusGreyling 12 วันที่ผ่านมา

    "Here it is visualized" LMAO

  • @ODDV69
    @ODDV69 19 วันที่ผ่านมา

    when i move the hands do not go with the gun i did everything like the video

  • @teste-x6o
    @teste-x6o 20 วันที่ผ่านมา

    Great work, thanks for explain how to rotate an object! For those in the future, i did it this way: using System.Collections; using System.Collections.Generic; using UnityEngine; public class Interactor : MonoBehaviour { public GameObject player; public Transform holdPosition; //if you copy from below this point, you are legally required to like the video public float throwForce = 500f; //force at which the object is thrown at public float pickUpRange = 5f; //how far the player can pickup the object from private float rotationSensitivity = 1f; //how fast/slow the object is rotated in relation to mouse movement private GameObject heldObj; //object which we pick up private Rigidbody heldObjRb; //rigidbody of object we pick up private bool canDrop = true; //this is needed so we don't throw/drop object when rotating the object private int LayerNumber; //layer index private PlayerMovement playerMovement; //Reference to script which includes mouse movement of player (looking around) //we want to disable the player looking around when rotating the object //example below //MouseLookScript mouseLookScript; void Start() { LayerNumber = LayerMask.NameToLayer("holdLayer"); //if your holdLayer is named differently make sure to change this "" playerMovement = player.GetComponent<PlayerMovement>(); //mouseLookScript = player.GetComponent<MouseLookScript>(); } void Update() { if (Input.GetKeyDown(KeyCode.E)) //change E to whichever key you want to press to pick up { if (heldObj == null) //if currently not holding anything { //perform raycast to check if player is looking at object within pickuprange RaycastHit hit; if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, pickUpRange)) { //make sure pickup tag is attached if (hit.transform.gameObject.tag == "canPickUp") { //pass in object hit into the PickUpObject function PickUpObject(hit.transform.gameObject); } } } else { if(canDrop == true) { StopClipping(); //prevents object from clipping through walls DropObject(); } } } if (heldObj != null) //if player is holding object { MoveObject(); //keep object position at holdPosition RotateObject(); if (Input.GetKeyDown(KeyCode.Mouse0) && canDrop == true) //Mous0 (leftclick) is used to throw, change this if you want another button to be used) { StopClipping(); ThrowObject(); } } } void PickUpObject(GameObject pickUpObj) { if (pickUpObj.GetComponent<Rigidbody>()) //make sure the object has a RigidBody { heldObj = pickUpObj; //assign heldObj to the object that was hit by the raycast (no longer == null) heldObjRb = pickUpObj.GetComponent<Rigidbody>(); //assign Rigidbody heldObjRb.isKinematic = true; heldObjRb.transform.parent = holdPosition.transform; //parent object to holdpositionition heldObj.layer = LayerNumber; //change the object layer to the holdLayer //make sure object doesnt collide with player, it can cause weird bugs Physics.IgnoreCollision(heldObj.GetComponent<Collider>(), player.GetComponent<Collider>(), true); } } void DropObject() { //re-enable collision with player Physics.IgnoreCollision(heldObj.GetComponent<Collider>(), player.GetComponent<Collider>(), false); heldObj.layer = 0; //object assigned back to default layer heldObjRb.isKinematic = false; heldObj.transform.parent = null; //unparent object heldObj = null; //undefine game object } void MoveObject() { //keep object position the same as the holdPositionition position heldObj.transform.position = holdPosition.transform.position; } void RotateObject() { if (Input.GetKey(KeyCode.R)) { canDrop = false; playerMovement.enabled = false; // Desativa o script para bloquear o movimento e olhar float XaxisRotation = Input.GetAxis("Mouse X") * rotationSensitivity; float YaxisRotation = Input.GetAxis("Mouse Y") * rotationSensitivity; heldObj.transform.Rotate(Vector3.down, XaxisRotation, Space.World); heldObj.transform.Rotate(Vector3.right, YaxisRotation, Space.World); } else { playerMovement.enabled = true; // Reativa o script canDrop = true; } } void ThrowObject() { //same as drop function, but add force to object before undefining it Physics.IgnoreCollision(heldObj.GetComponent<Collider>(), player.GetComponent<Collider>(), false); heldObj.layer = 0; heldObjRb.isKinematic = false; heldObj.transform.parent = null; heldObjRb.AddForce(transform.forward * throwForce); heldObj = null; } void StopClipping() //function only called when dropping/throwing { var clipRange = Vector3.Distance(heldObj.transform.position, transform.position); //distance from holdPosition to the camera //have to use RaycastAll as object blocks raycast in center screen //RaycastAll returns array of all colliders hit within the cliprange RaycastHit[] hits; hits = Physics.RaycastAll(transform.position, transform.TransformDirection(Vector3.forward), clipRange); //if the array length is greater than 1, meaning it has hit more than just the object we are carrying if (hits.Length > 1) { //change object position to camera position heldObj.transform.position = transform.position + new Vector3(0f, -0.5f, 0f); //offset slightly downward to stop object dropping above player //if your player is small, change the -0.5f to a smaller number (in magnitude) ie: -0.1f } } }

  • @Romik_123
    @Romik_123 24 วันที่ผ่านมา

    YOU ARE MY SAVIOR, LORD, I HAVE SUFFERED SO MUCH, AND HERE YOU ARE, THANK YOU, I WILL DEFINITELY MENTION YOU IN MY GAME!!!!!!!!!!!!

  • @fairplaymaxx7576
    @fairplaymaxx7576 28 วันที่ผ่านมา

    WOW I just do the same before watching your video!!- it's still usefull bc i see im not alone.

  • @3bdo7dana93
    @3bdo7dana93 29 วันที่ผ่านมา

    when i upload the fbx into unity it got no textures :( tried more then 1 still no textures even tho it got textures in blneder

  • @ohderjonnyX
    @ohderjonnyX หลายเดือนก่อน

    i guess im late but how can i remove the rotate feature

  • @BlipBlobFishman
    @BlipBlobFishman หลายเดือนก่อน

    "RigLayerLight" is crazy

  • @gamely3
    @gamely3 2 หลายเดือนก่อน

    Is there a way to make it have a certain rotation when you pick it up?

  • @Snow_Crab
    @Snow_Crab 2 หลายเดือนก่อน

    The music really brings me home.

  • @Rattle_me_Bones18
    @Rattle_me_Bones18 2 หลายเดือนก่อน

    every time a pick up an item, another copy is on top of it. how do i get rid of that

  • @portiaselamolela2815
    @portiaselamolela2815 2 หลายเดือนก่อน

    Thanks for help

  • @masoncrowe
    @masoncrowe 2 หลายเดือนก่อน

    dammit, cops just showed up at my door, looks like going to prison 50 year minimum. shouldve liked the damn video

  • @gizmowizard352
    @gizmowizard352 2 หลายเดือนก่อน

    I named my left rig layer RigLayerLight in honor of this tutorial

  • @frog4000
    @frog4000 2 หลายเดือนก่อน

    How can i change R to rotate the object to the Scroll wheel instead?

  • @Edix_32
    @Edix_32 2 หลายเดือนก่อน

    It wont let me pick up the object

    • @ahmadh4585
      @ahmadh4585 7 วันที่ผ่านมา

      Same

  • @Sxcottie
    @Sxcottie 3 หลายเดือนก่อน

    8:50 this was possibly the funniest thing ive seen in a tutorial

    • @4xh9
      @4xh9 หลายเดือนก่อน

      Before 6 months I saw it and it made me laugh I back now laugh again😂😂

  • @simongiordano5194
    @simongiordano5194 3 หลายเดือนก่อน

    I have a problem, when I take the object and move it to any side, it begins to deform slightly and lengthens or enlarges, how can I solve it?

  • @Sproute-RL
    @Sproute-RL 3 หลายเดือนก่อน

    wow that was very cool

  • @Kingplays342
    @Kingplays342 3 หลายเดือนก่อน

    my enemy aint chasing me when im in its vision

  • @Alphanerd2
    @Alphanerd2 3 หลายเดือนก่อน

    Not gonna like the video just since you said it in here but I will put it on the public playlist I credit my game jam entry to

  • @jimppui1350
    @jimppui1350 3 หลายเดือนก่อน

    Is there any way to include a text which tells what is the button to pick up the object. I have no idea where to put it since the pickup range is after the getkeydown. This would really help!

    • @jondevtutorials4787
      @jondevtutorials4787 3 หลายเดือนก่อน

      Hi! Yes that is definitely possible. You should add a canvas gameobject to the workspace, and add a text object to it. Then you can detect whenever a player mouses over the object you want to pick up by raycasting, checking if it hits the object. If it does hit the object, get it's position and use it to set the position of the text, you will then have to convert the coords from worldspace to screenspace. Then set the text of your canvas object to something like "Press E to pick up". If the raycast is not hitting any pick up objects then make sure the text is set to empty "". So basically all you are doing is placing a UI object in your 3D space, moving it around from object to object and changing the text. Look up some guides on 3D UI elements if you are struggling, best of luck :)

    • @jimppui1350
      @jimppui1350 3 หลายเดือนก่อน

      @@jondevtutorials4787 Im sorry, but can you give me an example for the script since I'm still pretty new to coding.

  • @Ruppertdinglesniffer
    @Ruppertdinglesniffer 3 หลายเดือนก่อน

    how do i drop it

  • @ChiappaRiello-op6zc
    @ChiappaRiello-op6zc 3 หลายเดือนก่อน

    Globox moment

  • @RHYSHALLDIGITALART00122
    @RHYSHALLDIGITALART00122 3 หลายเดือนก่อน

    ive been wrestling with adding animations from blender to unity. unitys import method is dog shit, lining up guns to the hand and not have anything clip is a nightmare. now i can see i can do it all inside unity i can seriously relax!

  • @marvellousdazza2836
    @marvellousdazza2836 3 หลายเดือนก่อน

    What if you have more than one gun? Do you have to use the arms on each gun individually?

  • @Paxmet
    @Paxmet 4 หลายเดือนก่อน

    Dry video, like it!

  • @RsSetayt
    @RsSetayt 4 หลายเดือนก่อน

    I'm working on something similar, but I want to work on an item that can be picked up and dropped off, I don't know how to do that, can you help me?

  • @duhanavc6773
    @duhanavc6773 4 หลายเดือนก่อน

    when I make the same settings in both of my cameras I think my unity only uses one camera and that is the pickupcamera in my unity everything goes black other than the objects in holdlayer. how can I fix it

  • @notuncleben6633
    @notuncleben6633 4 หลายเดือนก่อน

    It worked but when i try on an imported 3d object it still clips through the wall for some reason

  • @mgosnipples6331
    @mgosnipples6331 4 หลายเดือนก่อน

    A complex turn of events, as I am the man in that video, and have since learned from my actions and have liked the video before copy pasting your code. To further extend myself from my past transgressions I have also subscribed to show the courts and society that I am a better man

  • @WorksBones
    @WorksBones 4 หลายเดือนก่อน

    WHEN I PRESS E THE CUBE DISSAPEARS AND YES I PUT RIGIDBODY IN IT PLEASE HELP!!!

    • @ub3rfr3nzy94
      @ub3rfr3nzy94 4 หลายเดือนก่อน

      your pickupcamera isnt set to overlay

  • @PokimBarran
    @PokimBarran 4 หลายเดือนก่อน

    Thanks

  • @devmaheswari4909
    @devmaheswari4909 4 หลายเดือนก่อน

    Hey thanks for the great video, while trying to implement the code receiving the error ""GetRemainingDistance" can only be called on an active agent that has been placed on a NavMesh." even though both NPC and ground have their following component NavMeshAgent and NavMeshSurface(surface is baked too). No idea how to solve this issue, it would be very helpful if you can help me out

  • @MuharremKose-xm2uu
    @MuharremKose-xm2uu 5 หลายเดือนก่อน

    Dude, you say add half of the character's height according to the pivot point of your character, I don't understand how difficult it is to specify where to add this

    • @oliverfekete4512
      @oliverfekete4512 2 หลายเดือนก่อน

      This is what the best thing I could have come up with: StartCoroutine(LerpVault(firstHit.point + (Vector3.up * playerHeight / 2f), 0.5f));

    • @oliverfekete4512
      @oliverfekete4512 2 หลายเดือนก่อน

      If you are slipping of the edge use this: StartCoroutine(LerpVault(firstHit.point + (Vector3.up * playerHeight / 2f) + (Vector3.forward * 0.3f), 1f));

  • @SleepDreamDev
    @SleepDreamDev 5 หลายเดือนก่อน

    BRO THANKS

  • @bvra155
    @bvra155 5 หลายเดือนก่อน

    I have been struggling myself on a specific issue. I have been trying to develop a multiplayer survival fps game and the thing is i am not too sure on how to animate the item holding animations, i want to make only one global animation from maybe the player model so that the item that will be instantiated in the hands will have the same positions on all clients. Or maybe should i make different animations on local and remote players. Any suggestions?

    • @BRIANROSER
      @BRIANROSER หลายเดือนก่อน

      I would do completely seperate animations and models for the player vs opponents. Each client renders perfectly looking FPS rigs and animations that look right in FP. The opponents are then rendered with rigs and animations that look perfect in TP. Viola, no need to adjust anything to make it work in both views.

  • @ai-barq
    @ai-barq 5 หลายเดือนก่อน

    8:45 Caught Me Off Guard.

  • @misterioness4028
    @misterioness4028 5 หลายเดือนก่อน

    thanks it was quite a mystery on how we had hands visible

  • @WillowBruv3
    @WillowBruv3 5 หลายเดือนก่อน

    when i apply the script and then press play it doesn't start

  • @jondevtutorials4787
    @jondevtutorials4787 5 หลายเดือนก่อน

    For those asking about reload animations, if you want it to look professional you will most likely have to: 1) Create the animation in blender/unity (don't do it in unity), or just buy one / download one. 2) When its time to do the animation, disable the IK, then let the animation play 3) Re-enable it after the animation. Maybe you would want to use a game object to store where you animation starts so you can smoothly transition the gun position at the start. Personally I would just move the gun off screen or something because I hate working with animations.

    • @bigboy4432
      @bigboy4432 5 หลายเดือนก่อน

      i been thinking of importing the weapon and the arms separately and merge them both in the animations

  • @szotek-dg6il
    @szotek-dg6il 6 หลายเดือนก่อน

    but i want tutorial how to do it i dont want to copy and paste script

  • @Hyperforg
    @Hyperforg 6 หลายเดือนก่อน

    lol been trying to do this for ages with some goofy ass spaghetti code when I realised I can yoink the code. :p

  • @ricktherickrolled
    @ricktherickrolled 6 หลายเดือนก่อน

    oh my god it was THAT easy!!! Thank you so much!!

  • @vinnythehusky3481
    @vinnythehusky3481 6 หลายเดือนก่อน

    Question does anyone know how to make it work on VRCHAT?

  • @Vorkandor
    @Vorkandor 6 หลายเดือนก่อน

    For anyone else who has trouble with this: 1. Make sure to either name everything the same as Jon does or to rename them in the script file to what you've used. 2. By default the keys are 'E' to pick up/drop, hold 'R' and move mouse to rotate, and 'Left Click' to throw. This can be changed in the script. 3. Make sure the object you're picking up has a box collider and a rigidbody component. 4. Make sure on your camera (where you added the script) that 'Player' is set to the parent file of your camera movement. Hopefully, that helps some of you out. But if you're still stuck don't bother asking me for help. I just started learning Unity today, so idk lol.

    • @MASTERX-nw2gk
      @MASTERX-nw2gk 6 หลายเดือนก่อน

      You are amazing thank you !!!!.

    • @LucienLane
      @LucienLane 3 หลายเดือนก่อน

      i can get it a try