You might not be able to tell, but I am in a moment of despair. The reason? Humanoids. If I were to put a character in front of the camera with a humanoid – let’s say three studs away from the camera, the character would collide with the player. Now let’s also say that this character is client-side only. Now we can’t use collision groups. To solve this we can remove the humanoid, however, now we lose the auto UV Mapping of shirts and pants. So, I’ve had a few ideas that ended up failing. The one I will mention is the use of surface guis, rectoffset, and rectsize. Now let me also state this, SURFACE GUIS DO NOT WRAP AROUND MESHES. So, now that I have provided a reason to why that method does not work I would love to see some other methods. Although, I may just be coming at the surface gui method incorrectly, so if I am please propose to me the other way you could do it.
Support for collison groups on the client is pending according to the release notes for version 335, so hopefully that will be turned on soon.
Getting textures to work on NPCs involves using a hacky texture compositing workaround. You need to get a compositied texture and upload it as a decal, then set it to the texture of all the individual mesh parts for the NPC.
Here is what a compositied texture looks like (used in Theme Park Tycoon 2 by @Den_S).
One way of generating them is to dress your character how you want the NPC to look and then find the link to the texture using chrome developer tools and the 3D view of the character. There are also other ways to do this but that is probably the easiest.
Is this for NPC’s? Or is this for actual players colliding?
If it is for NPC’s, why don’t you use collision groups on the server and then have each client put all the NPC’s in storage?
The NPC and the player’s character would both have to be created on the server.
You can also dress your own character, copy (Ctrl-C) the character Model them while running Play Solo, stop Play Solo, and paste them back into the Workspace. Then, right-click the Model and Export Selection. It will save your character as an OBJ file, but it will also save out the composite textures as PNG.
Wish there was an api to do this automatically
A problem with both of your methods is that my NPC’s are randomly generated. I’m not going to save all the combinations down as composited textures.
How much do these NPCs do in game, enough that they need all of the Humanoid states like swimming and freefalling and such? I ask because you can put a Humanoid-equipped character into the Enum.HumanoidStateType.Physics (disabling all or most other states) and then make all of their body parts CanCollide false. Physics-state characters can still play animations, you just have to trigger them manually, you can’t just copy-paste the Animate script from a player character, since it transitions off of Humanoid states. To keep them falling through the ground, you can leave the feet collidable, hang them from constraints, anchor them (not so good looking for some animations) or weld them to an invisible base sphere if you need them to walk around.
All they need are the appearance components and animation components. So your method of setting the current state to the physics state is perfect. Thanks!
I attempted to disable all the other states besides physics and changing the humanoid state to physics, however the other body parts remain collidable
By default, in the Physics state, all of the body parts will be collidable. But unlike in the normal states, you can set CanCollide to false and it will stay false.
Yeah I’ve changed the state to physics, however, even when every other state has been disabled with SetStateEnabled(stateEnum,false) it changes back to FreeFalling (anchored torso might be the problem?) which I find odd. Also I did attempt disabling collision on the other objects, however due to that state change it didn’t take affect.