Changing entity collision group?

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
velocity
Member
Posts: 79
Joined: Sat May 10, 2014 6:17 pm

Changing entity collision group?

Postby velocity » Sun Aug 12, 2018 3:25 pm

Is it possible to change an entity collision group?

Entity(index).get_property_float('m_CollisionGroup')

This doesn't work
User avatar
L'In20Cible
Project Leader
Posts: 1066
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Changing entity collision group?

Postby L'In20Cible » Sun Aug 12, 2018 3:39 pm

This is not a float. That being said, that property is aliased: CBaseEntity.ini#L76

Syntax: Select all

Entity(index).collision_group
User avatar
velocity
Member
Posts: 79
Joined: Sat May 10, 2014 6:17 pm

Re: Changing entity collision group?

Postby velocity » Sun Aug 12, 2018 3:48 pm

How would I set the collision group? If I print that it just says NONE
User avatar
satoon101
Project Leader
Posts: 2562
Joined: Sat Jul 07, 2012 1:59 am

Re: Changing entity collision group?

Postby satoon101 » Sun Aug 12, 2018 3:53 pm

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
Image
User avatar
velocity
Member
Posts: 79
Joined: Sat May 10, 2014 6:17 pm

Re: Changing entity collision group?

Postby velocity » Sun Aug 12, 2018 3:55 pm

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?
User avatar
L'In20Cible
Project Leader
Posts: 1066
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Changing entity collision group?

Postby L'In20Cible » Sun Aug 12, 2018 3:57 pm

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).
User avatar
satoon101
Project Leader
Posts: 2562
Joined: Sat Jul 07, 2012 1:59 am

Re: Changing entity collision group?

Postby satoon101 » Sun Aug 12, 2018 4:03 pm

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.
Image

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 4 guests