About Store Forum Documentation Contact



Post Reply 
Actor groups and user data
Author Message
Outdoordoor Offline
Member

Post: #1
Actor groups and user data
Hello, could anyone please explain to me the concept of actor groups and user data? I'm talking about something like this:
Code:
obj[i].group(GROUP_OBJ).user(ptr(i));

(It's from the "Detecting objects under cursor" tutorial)

As far as I understand, groups are something like layers in other engines, they can be used to separate objects in the world into separate groups. And user data is perhaps some unique identifier of an object?

I am a bit confused about it, and would greatly appreciate it if anyone could explain these things to me.
10-05-2023 06:52 AM
Find all posts by this user Quote this message in a reply
RedcrowProd Offline
Member

Post: #2
RE: Actor groups and user data
the group is used by the engine in "collision group" to be able to set specific rules or query to this type. It is used with collision and raycasting quite a bit, and with it you can do things like ignore certain actor group, or create specific rules like making them ignore each other.

the user is literally a ptr to anything you want in memory, it is bound to the actor, and is passed to some of the function that goes with raycast or collision.

IIRC, what i used this for was typically with raycast. You can set certain actor group ignored/enabled, and then from what you get back you can then switch on group actor, then dyncast the user data, or use index to retrieve what was hit
(This post was last modified: 10-05-2023 07:27 AM by RedcrowProd.)
10-05-2023 07:24 AM
Find all posts by this user Quote this message in a reply
Outdoordoor Offline
Member

Post: #3
RE: Actor groups and user data
That was very helpful, thanks!
10-05-2023 07:35 AM
Find all posts by this user Quote this message in a reply
Pixel Perfect Offline
Member

Post: #4
RE: Actor groups and user data
In addition a problem I encountered helps demonstate another use of Actor Groups:

I had issues with game characters climbing some steps when first testing movement within the game. It appeared to be related to the physics capsule radius where thinner ones resulted in issues in climbing steps/stairs.

I created the class OBJ_STEPS to assign the step objects a custom Actor Group I named AG_STEPS which is used to ignore the capsule collision by adding the Actor Group to to the Physics.ctrl_ground_group_force. In this way the steps will always be walkable by character controllers regardless of step heights and slope angles.
10-07-2023 08:59 AM
Find all posts by this user Quote this message in a reply
Post Reply