OPENING a DOOR in UNITY with a RAYCAST

OPENING a DOOR in UNITY with a RAYCAST

SpeedTutor

3 года назад

52,658 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

xzctr wesfsd
xzctr wesfsd - 25.09.2023 18:03

But what if I have more than 1 door in my project? I need to create new MyDoorController and DoorRaycast scripts with different int-s? Is there not an easier way?

Ответить
Mikail
Mikail - 24.06.2023 23:17

how can i download the Script

Ответить
Omeed N Ouhadi
Omeed N Ouhadi - 29.05.2023 21:30

👏👏👏

Ответить
Lexmon
Lexmon - 16.05.2023 11:02

for some reason the raycast script isnt working properly (using the code from your patreon)
Tag: DoorButton is not defined.
cs:32

Ответить
MA GPlay
MA GPlay - 03.05.2023 16:59

i can't put raycast function in my code, i don't know why

Ответить
Lt.Private's
Lt.Private's - 01.05.2023 18:32

Ive decided to use this method rather than the physics/animated door I was trying to implement and I followed your tutorial twice, once to write the code and test then a second time just to see if I did anything wrong and it all looks exactly the same but nothing is working specifically the raycast. I tried using the debug.drawray and I've tried the comments on this video but unfortunately nothing

Ответить
PKD Studio IT industry
PKD Studio IT industry - 30.04.2023 12:29

Thanks a lot it helped in my project most of stuff dont have doors only the palace has it

Ответить
ThePolandengineer
ThePolandengineer - 27.04.2023 16:24

i got two errors saying:
error cs8805 program using top-level statements must precede namespace and type declarations
error cs1022 type or namespace definition or end-of-file expected
please help

Ответить
3dprint_object
3dprint_object - 03.04.2023 17:07

why is it showing me this error: the type or namespace name 'MyDoorController' could not be found. Please answer quick.

Ответить
We Control Your Insanity
We Control Your Insanity - 26.03.2023 21:20

This really helps and is great but one small issue I have is that why does my animation for closing the door and opening the door keep on looking even though loop time isn't checked?

Ответить
Busted Warden
Busted Warden - 23.03.2023 17:23

I spent 4 days trying to figure it out but after your tutorial it worked 👍🏻

Ответить
BMP Productions
BMP Productions - 07.03.2023 08:52

This probably has a simple answer, but... I really need to know how to get multiple doors and objects to have their respective animations work when clicked on. Example: I have multiple working doors but I have another object with cabinet doors that have different animations. Would that be able to be accessed through the DoorController script or will I need to make a separate one for that. If you can, explain what I could do here, please and thank you.

Ответить
RoyMGR
RoyMGR - 22.02.2023 00:20

Hello, I want to thank you for this video and the one about the door with the key, they have helped me A LOT, but I have a question, I'm starting with programming and I don't have much idea what to do, and I wanted to know if you could help me How can I do this but with a button, it's for an Android project haha
PS: Sorry if it is not understood but I am using the translator xd

Ответить
BountyKiller4
BountyKiller4 - 14.02.2023 03:45

for the [SerializeField] private Image crosshair = null; its mad at me for just putting Image, do you have any idea why? CS0246.

Ответить
zenya
zenya - 02.02.2023 02:20

I followed your tutorial but when I duplicate a door and open one of them it works fine but then trying to open the other door it doesn't work and only opens the first door I interacted with (if that makes sense) and the door also acts weird when I spam it to open and close it

Ответить
MxBshr
MxBshr - 17.01.2023 10:45

i managed to get this working but the crosshair doesnt go red for some reason?

Ответить
Γιώργος Λεμονής
Γιώργος Λεμονής - 14.01.2023 15:01

Anyone got that " I " character I aint finding it anywere

Ответить
The first blank
The first blank - 10.01.2023 00:38

Very funny, it works but not on drawers, spent 3H fixing it and it did not work

Ответить
Mothra
Mothra - 03.01.2023 08:03

Hey SpeedTutor. if you could respond to this that would be great im getting a Null ref Exeption Error whenm i click on the door, the door dosnt animate, the line is 44 and the code is

if(Input.GetKeyDown(openDoorKey))
{
raycastedObj.Play();
}
I hope you see this and can help me get it resolved

Ответить
G-Man
G-Man - 15.12.2022 01:43

very good tutorial! I use this method for shooting with raycast ammo crates break!

Ответить
BIVENS
BIVENS - 18.10.2022 14:10

is this way of opening the door the same as in granny, outlast, hello neighbor?

Ответить
BIVENS
BIVENS - 18.10.2022 14:08

is it possible to make this script universal? that is, not only for the door, for example, for a pull-out shelf?

Ответить
Darkm0n54
Darkm0n54 - 17.10.2022 05:38

hey just wanna ask can this also be applicable without the use of a mouse click? like with just a raycast after finding a gameobject with a specific layer it would trigger the gameobject specific action?

Ответить
DunderGuy
DunderGuy - 16.09.2022 03:15

This works great but what if I want multiple doors without having to create a separate animation for each door? When I duplicate the door it just snaps back to the original's position when I open it instead of playing the animation where the duplicate is. (if that makes any sense)

Ответить
Daniel
Daniel - 16.08.2022 01:01

Tag: InteractibleObject is not defined.
UnityEngine.Component:CompareTag (string)
DoorRaycast:Update () (at Assets/DoorRaycast.cs:31)

and I wrote the correct script

Ответить
Daniel
Daniel - 12.08.2022 01:40

Hello, when I install DoorRaycast, it gives me an error

Ответить
Triston Cooley
Triston Cooley - 27.07.2022 15:38

For the serialize fields its telling that they are valid in this context. I have them typed exactly as you have them.

Ответить
king Doom
king Doom - 11.07.2022 08:58

Thank you

Ответить
Zprey
Zprey - 01.07.2022 22:58

how to choose a range to player can interact in that range
?

Ответить
mustard -
mustard - - 29.06.2022 21:52

it's okay if this never gets seen, it's not a great place to be asking it

got the tutorial working with no issues, although I do have a question. I want to have several types of interactive objects, including chests and dresser drawers as well as doors. I got my chest animations made, but I can't get anything to work for the life of me. I honestly don't know if I should be putting any additional animations in the playAnimation function of the myDoorController script, or if there should be different logic in the doorRaycast that references a separate chest script.

in any case, right now I can't get the chest to animate at all, even though I do get a crosshair color change

thanks again for the awesome tutorial, regardless if this gets seen or not

Ответить
Amrut Siroya
Amrut Siroya - 24.06.2022 11:03

How can I make a goalkeeper ai

Ответить
Instinct Studios
Instinct Studios - 17.06.2022 22:35

When i do it, no animation plays

Null ref exception: Object reference not set to an instance of an object


I got this when i playtested

Ответить
Chrestycs
Chrestycs - 10.06.2022 20:26

I got a problem with the raycast, the error says: Assets\MyDoorRaycast.cs(15,30): error CS0246: The type or namespace name 'Image' could not be found (are you missing a using directive or an assembly reference?).
Then i added a canvas with a child named Image that is the crosshair, and still doesn't works. I don't know if it's because I didn't got my FPS of your channel of something.
Please help me

Ответить
KingZer0
KingZer0 - 16.05.2022 11:24

But what if there are multiple doors in a scene if they all use the same anim controller wouldn't they all open? How would I avoid this?

Ответить
KhorrorPS2
KhorrorPS2 - 09.05.2022 10:24

I copied literally everything in this video, triple checked it, and it still doesnt work

Ответить
Darius Jackson
Darius Jackson - 06.05.2022 06:54

THANK YOU, MY FINAL ASKED ME TO DO THIS. U SAVED ME

Ответить
gamer garand
gamer garand - 20.04.2022 17:34

Bro it's saying namespace 'Image' could not be found

Ответить
Gowy
Gowy - 14.04.2022 22:10

TYSM!!!!!

Ответить
CraftHunt
CraftHunt - 13.04.2022 20:47

can i add a cooldown before i use the door again? Because if i keep spamming it just repeats the animation in the middle of the other animation

Ответить
viking805fan
viking805fan - 12.04.2022 19:14

Hi there, thanks for the tutorial. Is there a way to make a laser (Line Renderer) trigger the door to open instead of player input by the use of a trigger box collider?

Ответить
The_M4ng0
The_M4ng0 - 25.03.2022 19:51

This WORKED PERFECTLY! Thank you SOO much!! <333
I just have one question, is there a way to make the door detect where the player is and play the corresponding DoorOpen and DoorClose animation for it when clicked? (basically open the doors away from where the player's position is) I'm very new to Unity, so maybe this is an easy problem to solve, but I truly have no idea on how to do it haha

Ответить
NIGHTCORE UKP
NIGHTCORE UKP - 21.03.2022 20:50

Everything worked except for the animations. Raycast is working an the crosshair is turning red, but the door animation is not playing. I don't know how to fix this.

Also this is a great video 👍

Ответить
JackTheAnimatorK618
JackTheAnimatorK618 - 08.03.2022 10:51

it says keycode cannot be found, are you missing a assembly reference?

Ответить
Backture
Backture - 05.03.2022 03:12

I have a problem, after opening the door (everything works the) I cannot close the door anymore and the crosshair is also not turning red anymore. Can somebody help?

Ответить
Synth3tic
Synth3tic - 27.02.2022 23:23

I cant add the DoorRaycast script onto the Camera and it Says because the script class cannot be found.

Ответить
Enrique José Carvallo Rioseco
Enrique José Carvallo Rioseco - 26.02.2022 12:53

it's not necessary to make 2 animations for the door, you can just copy the open animation in the animator and put the speed as -1

Ответить