How to make Npc on Different Layer

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Newby
:warning: Old Version Published before Godot 3 was released.

In the game im working on the player can bump into the npcs and push them around and it is causing problems for their movement. I want to make it so that the player cant push the npc but can still interact with them like talking or for enemy npcs attacking.

:bust_in_silhouette: Reply From: eons

The mask-layer for collision should be different than the one for interactions

If you want A to collide with B, A should have collision mask in the same bit than B collision layer and vice versa.

For non collisions, use Areas, those areas can be in the same layers-masks as the collision but is better to have them organized on another ones.
In the case of areas you have the interaction between areas (area enter-exit) and with bodies (body enter-exit).

Define the types of interactions on paper to get a clear picture on how to organize the layers and masks, also the type of objects to use.

so do i need to make the floor have the same layer as my player and npcs to be solid for them

Newby | 2017-11-17 02:07

Player and npc should have a mask on the same bit as floor layer, so both “see” the floor, but not masks on player and npc layer so they ignore each other.


A way to organize organize head around mask and layers is thinking that layer is where bodies “are” and mask where bodies “see” other bodies.

eons | 2017-11-17 02:55