Page 1 of 1

Changing entity collision group?

Posted: Sun Aug 12, 2018 3:25 pm
by velocity
Is it possible to change an entity collision group?

Entity(index).get_property_float('m_CollisionGroup')

This doesn't work

Re: Changing entity collision group?

Posted: Sun Aug 12, 2018 3:39 pm
by L'In20Cible
This is not a float. That being said, that property is aliased: CBaseEntity.ini#L76

Syntax: Select all

Entity(index).collision_group

Re: Changing entity collision group?

Posted: Sun Aug 12, 2018 3:48 pm
by velocity
How would I set the collision group? If I print that it just says NONE

Re: Changing entity collision group?

Posted: Sun Aug 12, 2018 3:53 pm
by satoon101
NONE is from CollisionGroup.NONE:
https://github.com/Source-Python-Dev-Te ... p.cpp#L357

To set it, just use the CollisionGroup enum:

Syntax: Select all

from entities.constants import CollisionGroup

Entity(index).collision_group = CollisionGroup.PLAYER

Re: Changing entity collision group?

Posted: Sun Aug 12, 2018 3:55 pm
by velocity
I just want to clarify that collision_group is under BaseEntity and not Entity so it is confusing in the documentation. Just to be clear all of BaseEntity functionality works with Entity?

Re: Changing entity collision group?

Posted: Sun Aug 12, 2018 3:57 pm
by L'In20Cible
Entity inherits from BaseEntity: _base.py#L73. So yes, everything available in BaseEntity is available for Entity but not the other way around (see Entity as being an extended version of BaseEntity).

Re: Changing entity collision group?

Posted: Sun Aug 12, 2018 4:03 pm
by satoon101
Notice that the second line under a class declaration in the documentation lists the "Bases" (or inherited classes) of that class.
http://wiki.sourcepython.com/developing ... ity.Entity

The documentation would grow exponentially if we listed all functionality under each class that it inherits from another.