Be the first to post for 'Using Gizmos To Visualise Code'!

I have to say that this is one of the most confusing of your videos that I have seen. Gizmos themselves seem to be pretty straightforward but the code changes and refactoring that you do feels very rushed and difficult to follow, possibly because you copy in chunks of code ‘from one I prepared earlier’, although you do review the code it takes quite a while to understand exactly what you are doing. I mention this because it seems to be such a contrast to your usual style of carefully taking the student through the code and building up understanding step by step.

2 Likes

@MithrilMan thank you your post really helped with my concept for my game. I am using 1.5 for my melee attack radius. that comes out to about 5 feet. For my ranged I’m going to use 10.

thx man yo saved my day…I had a same issue now solved .thank you very much.

Hey would anyone be kind enough to share their code up to this point. I was trying to code a little in my own direction but I’m not quite skilled enough as a coder to do that yet >_< so I want to follow this project exactly but I don’t really want to rewatch the last 4 hours to get all the code

This is my gizmos for move and attack

The gizmos. Pretty much what was requested. I also made a light that follows the cursor before the cursor affordances episode, just in case anyone wonder what Gizmos are those.

Progress being made.


A gizmo.
Gizmo.
Gizmo.
‘Gizmo’ no longer sounds like a real word.

I too was having the turning on location issue, have replaced with walkmovestopradius but doesn’t fix it when I click on an enemy! ohwell will fix it when the navmesh changes come in. really enjoying the course so far!

I separated the melee and ranged attack distances.

void OnDrawGizmos()
{
    Gizmos.color = Color.grey;
    Gizmos.DrawLine(transform.position, CurrentClickTarget);
    Gizmos.DrawSphere(CurrentClickTarget, 0.1f);
    Gizmos.DrawSphere(ClickPoint, 0.15f);

    //Draw Melee attack sphere.
    Gizmos.color = Color.red;
    Gizmos.DrawWireSphere(transform.position, MeleeAttackStopRadius);

    //Draw Range attack sphere.
    Gizmos.color = Color.cyan;
    Gizmos.DrawWireSphere(transform.position, RangeAttackStopRadius);
}

I’m currently focusing on gamepad movement. I have a sphere gizmo to show the targeting range. If there are enemies in the scene I can target the closest one (and switch between them in order of their horizontal screen position) by pressing one of the shoulder buttons. I draw a line gizmo to the currently selected target.

1 Like

That is what I intend to do for Gamepad support as well. Cool.

The second yellow sphere is to mock ranged attack radius like a flamethrower, or the radius of an Aura or whatever. I will comment it out though. The red sphere is for melee attacks, it is set to 1.5 meters which should be about the range of your arm + a crowbar or a standard sword/axe.

Otherwise I liked what was used in the video and saw no reason to change anything.

Thank you!

Hi

I decided to go for a bubble effect/blood cell effect for my health bar mask.

2 Likes

Hey guys,

I found a simple solution to the turning player character after the refactoring. Turns out the cameraRaycaster.hit.point also delivers the y-coordinate of the hit. In my case my player character wanted to reach his target high up in the air when I clicked bigger enemys. So the magnitude never really went to zero because of the height difference between player y-position and the click on the large enemy). I changed this by simply setting the point of the click to the cameraRaycaster.hit.point but reseted the y-coordinate of the Vector3 to the players y-position when storing the hit info

pointOfClick = new Vector3(cameraRaycaster.hit.point.x, transform.position.y, cameraRaycaster.hit.point.z);

This worked for me, maybe it will help some of you with your turning problems.

Cheers and happy coding!

2 Likes

I’ve made a function that if you press right click on the mouse you have 2 modes on the switch , you can have melee attacks and range attacks , if you target one enemy it will change the walkMoveStopRadius based on the type of the attacks :slight_smile: I hope it will be helpful for someone , and not to forget when you press back to a non enemy or a walkable ground it will come back to the default walkMoveStopRadius.

I’m really enjoying this course, I’ve learned a lot since the beggining. Using Gizmos really help you to understand the codes!

Privacy & Terms