A friendly commenter on my last video corrected a mistake, where I say that you need to reference scripts inside the Awake(), when it is actually supposed to happen inside the Start(). 🙂 Unfortunately I made these two videos at the same time, so I make this same mistake in this one as well hehe. Whops. 😅
@rigoabell48632 жыл бұрын
thx
@Envy-Animations9 ай бұрын
Yikes
@TheGloriousJeb2 жыл бұрын
Got it to work without disabling movement, used wait for end of frame instead of wait for seconds before changing position. Appreciate the help, spent the whole day tinkering on this.
@sherilynneherb48542 жыл бұрын
Could you please explain?
@duckenomics79819 ай бұрын
I love how slow you go through things! As a unity and coding beginner i feel like most tutorial fly past the details and I tend to get lost easily because of it. I will definitely sub and take a look at some of your other tutorials when I get the chance.
@SuperOsmaniac9 ай бұрын
Thanks for the tutorial! You've saved my day! I'm not very experienced with c# and have spent several hours trying to teleport my player without disabling a controller! =)
@Akaimari-kw8og Жыл бұрын
I was literally stuck on this for 2hours, no being able to teleport my player, you saved me! Thank you!!!
@real_unreal964410 ай бұрын
Thank you so much for this awsome tutorial. Ive been having issues for the last 3 hours but you saved me :D
@zengtian94512 жыл бұрын
Gosh Dani I've been using playmaker to set the player's position but continuously face the same 'teleport issue' you mentioned after deactivating the player everything is going well. You help me a lot really really thanks.
@superkitten75603 жыл бұрын
I know exactly zero about coding or programming and I have no idea what I just watched...but I still enjoyed it. Two thumbs up and a "like" lol
@creepermods4641 Жыл бұрын
Thank you so much bro. I'm working on Mobile Teleportation
@lobbywww2 ай бұрын
Nice work explaining this, thanks a lot! I'm trying to emulate elevator movement using teleportation. Using delay is a perfect approach.
@vraj20033 жыл бұрын
hey I have been learning php recently and your videos are helping me a lot, just wanted to say thank you.
@MatthiasGut3 жыл бұрын
Hello 😁Nice video, thumbs up! Since you were wondering how fast you can execute the coroutine; What you could do as well is 'yield return null'. That will wait for one frame and it will be enough to teleport the player. It might be of interesst why exactly that behaviour is happening at all and that little mystery I think I can explain. The reason is that the CharacterController component stores the position of the object in its own field and applies that position to the position field of the Transform component on every frame, basically overwriting the teleport input since the only official way to alter the position of the CharacterController internally is by using the Move() or MoveSimple() method of the CharacterController itself. Every time the CharacterController gets enabled it reads the position of the Transform component, therefore refreshing/overwriting the previous position stored. So technically it should be enough to only disable the CharacterController component itself, then teleport and after that enable it again. Might be preferential if you don't want to restart other scripts on the player object. Why exactly you weren't able to do all of it in the same frame I'm actually not sure about, might be some conflicht with the PlayerController script itself. Since I'm a lazy typer, what I do is using a little extension method for the CharacterController itself: public static class CharacterControllerExtensions { /// Moves the character controller (Transform) to specified position. /// Target position public static void TeleportTo (this CharacterController controller, Vector3 position) { controller.enabled = false; controller.transform.position = position; controller.enabled = true; } /// Moves the character controller (Transform) by specified vector. /// Vector to be moved by public static void TeleportBy (this CharacterController controller, Vector3 vector) { controller.enabled = false; controller.transform.position += vector; controller.enabled = true; } } Why unity itself isn't including functionality for that out of the box I don't understand. It's a hack as well, obviously, but it's a lot less typing and way less cluttered code. Extensions might be a bit far of for the tutorial series, maybe, but I thought I share this with you guys anyway. Another solution could be overwriting the position field of the CharacterController directly using System.Reflection, but that's way to advanced stuff for the tutorial series at this point. 🤣
@Dani_Krossing3 жыл бұрын
Oh cool! Didn't know 'yield return null;' would have the same effect. 😀
@КибершколаСмарторика5 ай бұрын
It works for me with CharacterController. Thank you very much!
@lukaspaver Жыл бұрын
Thanks Dani. I've been stuck for way too long on this bug in my game.
@GhostSy_8 ай бұрын
Thanks I was stuck there that was right very helpful.
@eznogamee37043 жыл бұрын
thanks soooooooooooo much for this video, i have struggle with this function in my game for days!!!! finally solve it
@SteadyPaceVince2 жыл бұрын
yo the best, I really needed this
@amitbt69 Жыл бұрын
Great Tutorial! thanks.
@Graviteam Жыл бұрын
Genial, hat mir sehr geholfen!!
@ggshout30195 ай бұрын
Thank you, disabling the rigidbody with this method made my Teleport Skill work each time now. I was baffled what's the reason for it only working sometime.
@darklord18172 ай бұрын
thank u so much!!!!
@i1234pipio3 жыл бұрын
Very useful info!! Thank you so much!
@gmangman123 Жыл бұрын
Thx so much master!
@_SF_Media3 жыл бұрын
Thanks for the video, it did help a little with one issue I had. Perhaps you could make something like this video that deals with multiple teleport spots? For example A -> B with option to go to C,D, or E from a list. IF you have the time, willingness and skills to do so that is. Not found anything like this out there yet.
@Dani_Krossing3 жыл бұрын
I will have a video up on that tomorrow 😊
@u2bt257 Жыл бұрын
Love the detailed explanation! Is there any chance to make this a lerping/smooth movement instead of an instant?
@RizevimVanZ11 ай бұрын
Perhaps chatgpt isnt as good as it sounds, thanks for the tut!
@tLr1n2 жыл бұрын
what is UpdateMouseLook and UpdateMovement at 6:20? Is it just your movement and mouse look scripts with the word update in front of them? Because when i do the same thing it says it doesn't exist
@sayed_technical3 жыл бұрын
Hi I am sayed from Bangladesh... I like your videos....
@sayed_technical3 жыл бұрын
i want to contact you.. please give me your contact address.. if you're set your WhatsApp number, then please give me your WhatsApp number please brother...
@rudikrasna6846 Жыл бұрын
thank you so much
@thewaterwasfine11 ай бұрын
spent the past 4 hours wondering why i couldnt get my player to teleport then came across this godsent video. unfortunately 0.01f is too fast for OnTriggerEnter teleporting so i think im just going to have to make a physics based playercontroller
@pulinho54518 ай бұрын
thx!
@JuliaEsAwesome3 жыл бұрын
Ik this is off topic of your video but do you know how much you will charge to check over someone ecommerce website-and let them know what they need to fix and add
@Dani_Krossing3 жыл бұрын
I don't do that type of service :) And to be honest I'm more of a front end developer than a back-end developer, so I wouldn't be able to help if it came to it.
@Sharky.Sharky.Sharky17 күн бұрын
You can also turn off the gameObject and then turn it back on very quickly
@FadilSyhptra2 жыл бұрын
Thank You!!!
@dertobbe1176 Жыл бұрын
Hi, I made some kind of UT 2004 transcolator. I just said player.position = transcolator.position... It Kanada works. But not always. My guess is that's it's about the right frame... How can I be sure to Set the New Position to the translocator Position no matter what?
@heykuze2 жыл бұрын
What if teleporting on an empty game object? And only when in an trigger to be able to? You need to add on onColliderEnter?
@regys95212 жыл бұрын
I loved it
@patelvraj1362 Жыл бұрын
one question : what i want to teleport an object that i have Instantiate in game ?
@TheDuckter Жыл бұрын
instead of clicking, is there a way to detect a colision with another object? (e.g: portal)
@TheDuckter Жыл бұрын
PS its a vr game
@darkman2372 жыл бұрын
Now if you wanted to go back to the first plane and end up at the same place you hit the button, how would that be accomplished?
@Dani_Krossing2 жыл бұрын
Just store your Vector3 at the moment of pressing the button, and then use that as your last teleported location. 🙂
@deadevil_fst7 ай бұрын
Thanks used this to make windows jump 😂
@zoomiee62292 жыл бұрын
Can I do this with “SetActive” instead of enabled?
@Dani_Krossing2 жыл бұрын
Sure, I can't see why not. 🙂
@zoomiee62292 жыл бұрын
How could i do this with a "OnTriggerEnter(Collider other)" method? Because im trying to do this with a vr game. Im just going to send my code here with what i have and if you can tell what I can do to fix it because I get a double float error.
@legoose2 жыл бұрын
Hi, Visual studio noob here. Would you kindly inform me how to turn on (not 100% sure what it's called) the auto complete. I've been looking at visual studio for the last two hours and still haven't found the settings.
@Dani_Krossing2 жыл бұрын
My "how to install Unity" video shows how. :)
@Omnivoid2210 ай бұрын
I cant find a tutorial that shows how to teleport a character, when they press a button
@johanneswagenknecht7372 жыл бұрын
Hey @Dani Krossing, I was wondering what the sign after playercontroller in line 12 is? Please help me because im going to fail IT class.
@Dani_Krossing2 жыл бұрын
One of the most useful and often used skills of any IT person, is Google. 🙂 If you search "What are the symbols called?" then you will find your answer. It took me 20min to see your comment and reply, where as a Google search takes 10sec. 😉Not trying to sound snarky hehe (maybe a little).
@Stoney_Eagle3 жыл бұрын
I don't have Danish translations implemented yet so I thought I just do one where it matters the most to me... Howcome a 3-word sentence is wider in pixels in Danish than the English version even tho they are the same character length? 😂😅😭 It's that crazy æ symbol I guess, my dynamic font size calculation doesn't work because of it... It's a good thing I see it now before release.
@lotfitej81012 жыл бұрын
This has been fixed on latest Unity update. No need to use couroutine.
@StickyLabDev8 ай бұрын
"sometimes failed" is why im here
@devonlewis4442 жыл бұрын
okay, so Is there a way to teleport a specific distance? instead of to a certain object? because I'm making a game where a monster is at the end of a hall way, teleporting towards you every 5 seconds or so, and I was wondering if there was a way to make it move a specific distance, and maybe to randomize the location of where it teleports to in between the walls. (sorry, I know that might be a lot, but I'm kinda lost lol)
@Dani_Krossing2 жыл бұрын
You can create a Coroutine that runs a function every 5sec, and then inside the function you get the direction towards the player using a normalized offset of the player and the monster, and just add the distance you want it to teleport. 🙂 This video can help you getting the offset: kzbin.info/www/bejne/aWHCpKOIaMh2rtk&ab_channel=DaniKrossing
@devonlewis4442 жыл бұрын
@@Dani_Krossing Update, I've figured out the code. XD My only issue now is that I used a Random.Range for the x axis, so that it would move around the hallway when it teleported. But the range I set moves with the object, so sometimes it teleports outside of the hallway. and I have no idea what a solution would be to that. .-.
@alex_ig_ Жыл бұрын
you look like if elon musk made video games. no offence
@3th1nhawn502 жыл бұрын
i acidently made a teleport its not that complicated
@3th1nhawn502 жыл бұрын
just take dani grapple gun script and make it a fixed joint instead of spring joint