You're not the first to ask, I've got this topic on my list of ideas! What I have found to work well is not necessarily to change the cursor, but rather to use a Projector on a gameObject that follows the mouse cursor. Raycast from the camera through the mouse cursor to get a position on the ground. Then create a gameObject that constantly updates it's position to that of the raycast. Then swap out that gameObject with a projector that uses a "target cross." Hope that helps!
hello i need help. im trying to make a top down shooter, ive managed to get the character moving at all direction and it faces all directions but i cant get the character to rotate with curser =. could i get some help im new to bolt and dont know how to c#
I'd suggest making use of the unit Transform LookAt. This will rotate a transform (you can choose which axis) to look at another transform. Hope that helps.
You might check out the whole playlist for this series? Maybe you did? It's been a while since I've made these videos, but I suspect that's how I made the player object face the cursor. Playlist: th-cam.com/play/PL7S-IAgf3dlVjaa0i7eCYbMlEpzCYk7ag.html
heyy, at first, nice video, that really helped me!!!! aaaaaaand, when i add the nev mesh agent, it says that its missing a nav mesh agent component, where do i add that to?
Been a while since I looked at that video, but yes it should be farily easy. Instead of raycasting from the camera to the mouse you raycast from the camera through the middle of the screen. Since the mouse position is originally given in screenspace it should be pretty easy. You can get the width and height of the screen, divide each by 2 (screenspace coordinates) and use those as the x and y coordinates to create a new vector3. The z-value should be slightly positive to ensure it's in front of the camera. This new vector can be used to create the ray and the rest should be pretty similar. Hope that helps. Feel free to drop by the OWS discord if you need a bit more help.
Hmm. Sounds like a variable scope issue to me. Or maybe something isn't a prefab that should be. Any chance you can drop a screenshot over on the OWS discord (link in the video description)? Something that shows the hierarchy, the projectile, and the variables window?
Hm, is the bullet supposed to intersect the ground at the point it is clicked or keep on going past it? I'm getting the first result, but I feel like in most games it should keep going. What do I have to change to make that happen?
Yeah it probably does. What you can do it add a vector something like (0,2,0) to the target position. This way it goes to the point clicked, but up two units. Does that help/make sense?
Hi, I have a problem. On the first “layer mask literal” dropdown, I can’t seem to find “enemy” or “terrain”. Are they tags? How do I add these in? As they seem pretty essential to the code 😅 Also when I run my code, it stops at the "set variable target" module. Yet I have a "Target" variable set, under graph variables as a vector 3.
@@OneWheelStudio Hi again, thank you for you're reply. I they still don't pop up under the layer mask drop down. I have saved and restarted Unity just to be safe but alas nothing. Tags are assigned to the floor and enemy as well. So I am confused 😅
@@justsomeone64 @J w L Sorry, I think I misspoke or at least didn't think enough. You will need to add LAYERS not tags. It's been a long while since I made those videos.
@@OneWheelStudio I have the gameobject linked to the instatiate node that the rigidbody getcomponent is flowing to. I had to create a target "to" object a little farther down z from the muzzle to normalize a vector without a click.
An amazing series, appriciate the tutorials, keep it up
all hail one wheel studio
hwo to change the cursor to a target cross?
You're not the first to ask, I've got this topic on my list of ideas!
What I have found to work well is not necessarily to change the cursor, but rather to use a Projector on a gameObject that follows the mouse cursor. Raycast from the camera through the mouse cursor to get a position on the ground. Then create a gameObject that constantly updates it's position to that of the raycast. Then swap out that gameObject with a projector that uses a "target cross."
Hope that helps!
hello i need help. im trying to make a top down shooter, ive managed to get the character moving at all direction and it faces all directions but i cant get the character to rotate with curser =. could i get some help im new to bolt and dont know how to c#
I'd suggest making use of the unit Transform LookAt. This will rotate a transform (you can choose which axis) to look at another transform.
Hope that helps.
@@OneWheelStudio i don't know how to go about it but thanks ill give it a shot
You might check out the whole playlist for this series? Maybe you did? It's been a while since I've made these videos, but I suspect that's how I made the player object face the cursor.
Playlist: th-cam.com/play/PL7S-IAgf3dlVjaa0i7eCYbMlEpzCYk7ag.html
heyy, at first, nice video, that really helped me!!!! aaaaaaand, when i add the nev mesh agent, it says that its missing a nav mesh agent component, where do i add that to?
The nav mesh agent goes on the object that will move around - ie the player and or npc in this setting.
Is there a simple way to convert this into a 1st person raycast?
Been a while since I looked at that video, but yes it should be farily easy. Instead of raycasting from the camera to the mouse you raycast from the camera through the middle of the screen. Since the mouse position is originally given in screenspace it should be pretty easy. You can get the width and height of the screen, divide each by 2 (screenspace coordinates) and use those as the x and y coordinates to create a new vector3. The z-value should be slightly positive to ensure it's in front of the camera. This new vector can be used to create the ray and the rest should be pretty similar. Hope that helps. Feel free to drop by the OWS discord if you need a bit more help.
For whatever reason, whenever I click on the rifle and then make the projectile spawn, the object variable is dimmed and inaccessible. Any ideas?
Hmm. Sounds like a variable scope issue to me. Or maybe something isn't a prefab that should be. Any chance you can drop a screenshot over on the OWS discord (link in the video description)? Something that shows the hierarchy, the projectile, and the variables window?
Hm, is the bullet supposed to intersect the ground at the point it is clicked or keep on going past it? I'm getting the first result, but I feel like in most games it should keep going. What do I have to change to make that happen?
Yeah it probably does. What you can do it add a vector something like (0,2,0) to the target position. This way it goes to the point clicked, but up two units. Does that help/make sense?
@@OneWheelStudio Yep! I determined what I wanted to add (in this particular case) was the Y position of the character's capsule collider
Glad you got it figured out.
Hi, I have a problem. On the first “layer mask literal” dropdown, I can’t seem to find “enemy” or “terrain”.
Are they tags? How do I add these in? As they seem pretty essential to the code 😅
Also when I run my code, it stops at the "set variable target" module.
Yet I have a "Target" variable set, under graph variables as a vector 3.
Yes those are tags. You will need to create new tags which can be done at the top of the inspector.
@@OneWheelStudio Hi again, thank you for you're reply.
I they still don't pop up under the layer mask drop down. I have saved and restarted Unity just to be safe but alas nothing.
Tags are assigned to the floor and enemy as well. So I am confused 😅
@@justsomeone64 @J w L Sorry, I think I misspoke or at least didn't think enough. You will need to add LAYERS not tags. It's been a long while since I made those videos.
@@OneWheelStudio That's fine, all good now!
I'll like the videos as well 👍 I really appreciative of your responses 🙂
I am getting floaters and being pushed back by the force.
Sounds like the force may be getting applied to the player and not the bullet?
@@OneWheelStudio I have the gameobject linked to the instatiate node that the rigidbody getcomponent is flowing to. I had to create a target "to" object a little farther down z from the muzzle to normalize a vector without a click.