3d projectiles?

jrhetf4xb

Member
It has been bugging me for a while but why don't most projectile systems offer 3d collision detection as well? The way I imagine it is like a simple check with GetUnitFlyHeight() (of course combined with a normal XY group enum), something like:

Code:
``````if (RAbsBJ(GetUnitFlyHeight(collidedTarget) - GetUnitFlyHeight(projectile)) <= PROJECTILE_RADIUS) then
//... all that stuff``````
Or maybe I'm missing something?

SerraAvenger

Cuz I can
It has been bugging me for a while but why don't most projectile systems offer 3d collision detection as well? The way I imagine it is like a simple check with GetUnitFlyHeight() (of course combined with a normal XY group enum), something like:

Code:
``````if (RAbsBJ(GetUnitFlyHeight(collidedTarget) - GetUnitFlyHeight(projectile)) <= PROJECTILE_RADIUS) then
//... all that stuff``````
Or maybe I'm missing something?
Please print GetUnitFlyHeight of flying units to the screen. Then also raise the terrain upon which the unit is standing and print GetUnitFlyHeight of that to the screen.

I guess the main problem lies somewhere around this. I haven't used Wc3 for ages, so I can't really tell.

IIRC, Azlier made some nice scripts to figure out the real z coordinate of a unit. Dunno, though.

Trollvottel

never aging title
There some points you forgot.
1. The thing SerraAvenger mentioned: If there are different terrain heights, there will be different z-heights of units that have the same flying height.
the Z-height is just flying height of unit + GetLocationZ at it's position.

2. You cant calculate the distance like this. If you do it like this, you will get a cube in which you pick the units and not a sphere.

Do it like this:

Now use pythagoras (pseudocode):

If ((projectileX-collidedTargetX)² + (projectileY-collidedTargetY)² + (projectileZ-collidedTargetZ)² <= PROJECTILE_RADIUS) then
Do all that stuff

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
>It has been bugging me for a while but why don't most projectile systems offer 3d collision detection as well?

Which systems are you referring?

One thing no system has is 3d collision of units to destructables due to no GetDestructableZ =/.

OT: What was the better way of doing collisions The GroupEnumUnitsInRange or with a Rect entering event? One of them wasn't suitable for very high speed projectiles but I forgot which one.

jrhetf4xb

Member
Yes, terrain height would definitely be included but it was a quick example.
And I have no idea (my math level being low also included ). how Pythagoras theorem would have anything to do with spherical shapes...

> Which systems are you referring?
All submitted?

> One thing no system has is 3d collision of units to destructables due to no GetDestructableZ =/.
Meh, unit to unit has a chance to be used more

Trollvottel

never aging title
K, image example following.
hope you understand it.

lol, drnk on teh internetz

/edit: the center of the point is your object. the square on is the one with which you check collision.

/€²: There is a mistake in the image. in the left circle the square should be closer to the center so that it seems to be in range (so it is in the circle).

Attachments

• 27.8 KB Views: 277

Accname

2D-Graphics enthusiast
you should also keep in mind the wc3 engine auto-adjusts flying heights of flying units when they come close to cliffs. between 2 cliff levels the flying height of the unit will not be equal to the actual height in which it is displayed on the screen.

jrhetf4xb

Member
^ Wouldn't that affect the dummy units (projectiles) as well?

I'm not sure I quite understand but from the calculations it seems that (looking at the right image):
d should be less than r so that the projectile can collide, right?

Trollvottel

never aging title
jop, thats right. and for that you need my calculations. your calculations would pick units in a cylinder (i drew the square in which you picked the units).

jrhetf4xb

Member
Makes perfect sense now that I think of it, thanks for the tip

General chit-chat
Help Users
• No one is chatting at the moment.
• The Helper:
Friday Yay!
• mgarcia:
did you guys catch Carl's interview? https://www.youtube.com/watch?v=kuHiMXABkGs
• mgarcia:
he's the one that informed me about the DVD's working!
• mgarcia:
he also mentioned the progress on the controllers!
• The Helper:
I did actually it was cool to see the NUON mention
• The Helper:
https://discord.com/channels/985377399338332202/985377399950696481 you can still use this chat too we are two fisted now
• thewrongvine:
costs me \$80 to fill gas tank sad face
• Ghan:
Oof
• The Helper:
Yeah that gas is some expensive stuff
• The Helper:
ghan does not have to worry about it he has a tesla and I have a small tank so it does not cost me usually more than 50
• The Helper:
fyi Ghan we are getting an error trying to access stats or world editor tutorials Error 526 Ray ID: 72128c6bf99f6707 • 2022-06-26 02:35:15 UTCInvalid SSL certificate
• Ghan:
An artifact of switching to Cloudflare... the Let's Encrypt certs can't autorenew through Cloudflare.
• Ghan:
I got the forum updated before things expired but there were some other casualties.
• Ghan:
Everything should be fixed now....
• The Helper:
Thank you Ghan!
• The Helper:
Happy Monday!
• The Helper:
new NUON forum mod cubanral!
+1
• The Helper:
• tom_mai78101:
Started learning how to make tools-assisted speedruns, so I'm lately busy.
• tom_mai78101:
Here's my current project.
+3
that was pretty good!
• jonas:
really cool! I saw the game before but always thought it's just a half as good double dragon. Now I realize it actually has a lot of depth!
• The Helper:
I just saw a bunch of running and jumping past all the enemies look like it was scripted as he said I guess I should have watched the whole thing. I only got a couple of minutes in. You should post that video in the forum Tom
• Darthfett:
"Hi in the chat!"
+2
• tom_mai78101:
Currently busy with making the run even better, so I'll post that new one once I'm done. Right now, I had to modify the emulator itself, the tools that makes this video, and some RAM address disassembling / reverse-engineering to get the right values, and such.
+1