#making a melee weapon with a collision shape

14 messages · Page 1 of 1 (latest)

lucid yarrow
#

for hitscan weapons, I use the following:

            killblaster_scan.get_collider().hurt(20) ```
where killblaster_scan is a raycast3d and .hurt(20) reduces the variable `health` by (int) from a maximum of 100 to a minimum of 0, and at 0, the target dies. That all works fine.

How do I translate this to checking if a 3d shape is colliding with the target, calling the target's functions, and triggering hurt(int)
#

I've tried the obvious thing, just adding an area3d with a shape, it doesn't work with staticbody3d, meshinstance3d, area3d, collisionshape3d

#

I get a crash with
invalid call. Nonexistent function 'is_colliding' in base "area3d"

#

I can't find any documentation regarding what nodes do have is_colliding

#

decided to just go through the list of all node types

#

sigh

#

found shapecast3d

#

it's exactly what I need isn't it

#

I'll try that

#

get the object impacted
If it's no bother, how would I go about this part?

#

I can’t check them for a function like with raycast3d?

#

oh that seems reasonable thank you
Will try that asap

lucid yarrow
#

I don’t intend to have friendly NPCs in combat scenes, or multiplayer, so it shouldn’t be an issue. Thanks.