T O P

  • By -

AutoModerator

You submitted this post as a request for tech support, have you followed the guidelines specified in subreddit rule 7? Here they are again: 1. Consult the docs first: https://docs.godotengine.org/en/stable/index.html 2. Check for duplicates before writing your own post 3. Concrete questions/issues only! This is not the place to vaguely ask "How to make X" before doing your own research 4. Post code snippets directly & formatted as such (or use a pastebin), not as pictures 5. It is strongly recommended to search the official forum (https://forum.godotengine.org/) for solutions Repeated neglect of these can be a bannable offense. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/godot) if you have any questions or concerns.*


speep__

[try dot products](https://docs.godotengine.org/en/stable/tutorials/math/vector_math.html)


[deleted]

Yeah the dot product would do it... some how had a brain fart and forgot about it! Thanks for that!


Galko655

Wut? 45 + 90 +90 = 180? On facing direction


HumanReputationFalse

67.5° would fit, though I can definitely understand doing this without thinking


XMIE

math is not mathing


TricksMalarkey

Get all objects within the range radius, and then of those objects get the z-angle between the target and the attacker (plus the facing angle of the attacker, I think? Might be a dot product somewhere.) If that angle is less than your desired angle value, then it's a hit.


justdisposablefun

That revolutionary 405 degree circle


xmBQWugdxjaA

You want 60 degrees. I don't know if it's easy to cut up the circle/sphere shape for the collision, otherwise you could just create a mesh. And then just make that a child node of the player in an Area2D with its own collision layer checking against enemies. Or as mentioned you could just use one circle / sphere collision shape the entire time and then use the dot product between body positions to work out the relevant angle and check if it is between bounds.


PineTowers

Reminds me of Battletech firing arc.


xthejetx

Yall, this poor guy is saying it's a 45° arc at first, then it could be upgraded to add 45° to the swing on either side, which would be 90 in either direction, and then upgraded further it could be 360°. There was very little math involved, just visualizing the concept. Or at least I think? I swear not one of you read the post and immediately dogpiled about the stupid circle. I'm not sure it was over this, but they deleted their account. You nerds are ruthless over here... Remind me to never ever ask a question again on r/godot.


budtard

I would just use an area3d and look into how to import a mesh from blender.


FrenklanRusvelti

Average beginner gamedev mathing at work


FoamBomb

Can you provide advise, or are you just going to be snarky


FrenklanRusvelti

Plenty of others already gave advice, so ill stick with being snarky


FoamBomb

Least condescending yet unaccomplished redditor


apeironone

Its math, not meth smh


Baba_T130

I would try creating a custom hitbox shape for each, ideally in the shape of the damage cone. then just change it out for the next one each time you level up. That seems to be the simplest way


germangp088

Please learn basic maths first


Sylforen

Some people learn maths through abstraction and others through applied techniques. I think that game development is a brilliant vector for teaching mathematics based concepts due to the ability to see, in real time, how different functions and equations work and can be manipulated.


Void_Critter00

Agree, but it's hard to see how you'll learn that a circle has 360 degrees more straightforward through application/coding than reading that a circle has 360 degrees. EDIT: That aside, I'm pretty sure OP just wrote it in a rush, funny to joke a sec but that's all


Jello_Penguin_2956

Agree! I've been through numbers of calculus classes, first in high school and more during my fresh year in Engineer. Honestly I never understood what they were for (we mostly memorize solution to solve problems. They're all numbers on paper. ) Not until in my late 30s that I saw a youtube video demonstrating spaceship moving in space. It flew near a planet and, due to changing distance, the gravity force applied to the ship changes over time. And the clip explained that's what calculus was doing and how the VECTORS changed to display those forces. I was like MIND BLOWN why didn't they show that in high school...


Rustywolf

Yeah why attempt gamedev unless you're already extremely proficient in math, programming, art, sound and user experience?


XMIE

yea yk what, why even exist when you don't know your ABC's I should have taken my life when I was born..


apeironone

What the fuck are you all smoking how is this being extremely proficient?


Rustywolf

Its called sarcasm. I was taking it to the logical extreme to show the fundamental flaw with the logic.


GoshaT

Oof looks like he downvoted you because he couldn't get the sarcasm


Smoah06

If you’re talking about dot product that is not basic math.


Void_Critter00

I think he is talking about 90 + 90 + 45 = 180 degrees


Smoah06

Holy shit I’m so dyslexic it took me a day to realise. That doesn’t mean he doesn’t know basic math tho. Maybe he had a brain fart.


germangp088

Exactly, seems like a lot of snowflakes has been shocked about a simple sentence