Raised This Month: $115 Target: $400
 28% 

Creating solid entity [CS:GO]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SWRHARD
Junior Member
Join Date: Sep 2019
Old 09-10-2019 , 11:18   Creating solid entity [CS:GO]
Reply With Quote #1

Hi, i have some problems with adding a solid entity.
I have this code:

Code:
public Action Build(int client, const char[] command, int argc) {
    int index = CreateEntityByName("prop_dynamic");
	if(index > -1) {
	    SetEntityModel(index, TEST_ENTITY);
	   	SetEntProp(index, Prop_Send, "m_nSolidType", 4);
		SetEntProp(index, Prop_Data, "m_CollisionGroup", 18);
		AcceptEntityInput(index, "EnableCollision" );
        DispatchSpawn(index);

        SDKHook(index, SDKHook_OnTakeDamage, TakeDamageFunc);
...
	}
	return Plugin_Handled;
}
Problem: i can hit my created entity, it works so good, but i also can walk through this model, but i want to forbid this.
I try to use all values for solid type
Code:
enum SolidType_t
{
	SOLID_NONE			= 0,	// no solid model
	SOLID_BSP			= 1,	// a BSP tree
	SOLID_BBOX			= 2,	// an AABB
	SOLID_OBB			= 3,	// an OBB (not implemented yet)
	SOLID_OBB_YAW		= 4,	// an OBB, constrained so that it can only yaw
	SOLID_CUSTOM		= 5,	// Always call into the entity for tests
	SOLID_VPHYSICS		= 6,	// solid vphysics object, get vcollide from the model and collide with that
	SOLID_LAST,
};
and for collision group:

Code:
enum Collision_Group_t
{
	COLLISION_GROUP_NONE  = 0,
	COLLISION_GROUP_DEBRIS,			// Collides with nothing but world and static stuff
	COLLISION_GROUP_DEBRIS_TRIGGER, // Same as debris, but hits triggers
	COLLISION_GROUP_INTERACTIVE_DEBRIS,	// Collides with everything except other interactive debris or debris
	COLLISION_GROUP_INTERACTIVE,	// Collides with everything except interactive debris or debris
	COLLISION_GROUP_PLAYER,
	COLLISION_GROUP_BREAKABLE_GLASS,
	COLLISION_GROUP_VEHICLE,
	COLLISION_GROUP_PLAYER_MOVEMENT,  // For HL2, same as Collision_Group_Player, for
										// TF2, this filters out other players and CBaseObjects
	COLLISION_GROUP_NPC,			// Generic NPC group
	COLLISION_GROUP_IN_VEHICLE,		// for any entity inside a vehicle
	COLLISION_GROUP_WEAPON,			// for any weapons that need collision detection
	COLLISION_GROUP_VEHICLE_CLIP,	// vehicle clip brush to restrict vehicle movement
	COLLISION_GROUP_PROJECTILE,		// Projectiles!
	COLLISION_GROUP_DOOR_BLOCKER,	// Blocks entities not permitted to get near moving doors
	COLLISION_GROUP_PASSABLE_DOOR,	// Doors that the player shouldn't collide with
	COLLISION_GROUP_DISSOLVING,		// Things that are dissolving are in this group
	COLLISION_GROUP_PUSHAWAY,		// Nonsolid on client and server, pushaway in player code

	COLLISION_GROUP_NPC_ACTOR,		// Used so NPCs in scripts ignore the player.
	COLLISION_GROUP_NPC_SCRIPTED,	// USed for NPCs in scripts that should not collide with each other

	LAST_SHARED_COLLISION_GROUP
};
can u help me with it, thanks

Last edited by SWRHARD; 09-10-2019 at 11:19.
SWRHARD is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 09-10-2019 , 19:28   Re: Creating solid entity [CS:GO]
Reply With Quote #2

Try SOLID_BSP with COLLISION_GROUP_INTERACTIVE
__________________
Neuro Toxin is offline
1337norway
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 09-10-2019 , 22:11   Re: Creating solid entity [CS:GO]
Reply With Quote #3

Does the model have a proper physics box?
__________________
Taking Free/Paid Requests! Send a PM
--->Donate here if you like my work. <--- (or ask for my paypal in private)
1337norway is offline
SWRHARD
Junior Member
Join Date: Sep 2019
Old 09-11-2019 , 01:57   Re: Creating solid entity [CS:GO]
Reply With Quote #4

Quote:
Originally Posted by 1337norway View Post
Does the model have a proper physics box?
I think yes, I checked 2 different models, one of these:

SWRHARD is offline
SWRHARD
Junior Member
Join Date: Sep 2019
Old 09-11-2019 , 01:58   Re: Creating solid entity [CS:GO]
Reply With Quote #5

Quote:
Originally Posted by Neuro Toxin View Post
Try SOLID_BSP with COLLISION_GROUP_INTERACTIVE
not working( i still can walk through this
I noticed a strange thing that when I shoot not in the model, the callback OnTakeDamage still works, it stops only when I start shooting on the other side of the map, probably collision group is wrong
May be wrong order (SetEntProp before DispatchSpawn or opposite), is it important?

Last edited by SWRHARD; 09-11-2019 at 03:27.
SWRHARD is offline
BHaType
Senior Member
Join Date: Jun 2018
Location: Methamphetamine
Old 09-11-2019 , 05:52   Re: Creating solid entity [CS:GO]
Reply With Quote #6

Quote:
Originally Posted by SWRHARD View Post
not working( i still can walk through this
I noticed a strange thing that when I shoot not in the model, the callback OnTakeDamage still works, it stops only when I start shooting on the other side of the map, probably collision group is wrong
May be wrong order (SetEntProp before DispatchSpawn or opposite), is it important?
Try this

PHP Code:
DispatchKeyValue(index"solid""6"); 
__________________
Heart
BHaType is offline
Send a message via AIM to BHaType
SWRHARD
Junior Member
Join Date: Sep 2019
Old 09-11-2019 , 09:11   Re: Creating solid entity [CS:GO]
Reply With Quote #7

i try to use "Christmas tree" model from shared plugin and all works good, i cant move through the tree, dont understand why it's not working with my models, they have physics files too.
I notices one thing, when i walk through my model, my speed slows down and when i jumping on my model, i hear the sound of model material, but falls into it, i think physics file is bad, i opened this file in blender and all seems good :/



UPDATE: i input a command "vcollide_wireframe 1" in the game, that to view collision meshes, and i saw, that my model doesnt have meshes xd, how it's possible, i dont know

Last edited by SWRHARD; 09-11-2019 at 12:17.
SWRHARD is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 09-11-2019 , 18:33   Re: Creating solid entity [CS:GO]
Reply With Quote #8

Wait. U need to dispatch spawn before changing netprops.
__________________
Neuro Toxin is offline
SWRHARD
Junior Member
Join Date: Sep 2019
Old 09-12-2019 , 00:48   Re: Creating solid entity [CS:GO]
Reply With Quote #9

this code works good for Christmas tree model:

Code:
public Action Build(int client, const char[] command, int argc) {
    int index = CreateEntityByName("prop_dynamic");
	if(index > -1) {
	    SetEntityModel(index, TEST_ENTITY);
	   	DispatchKeyValue(index, "Solid", "6");
        DispatchSpawn(index);

        SDKHook(index, SDKHook_OnTakeDamage, TakeDamageFunc);
        SetEntityMoveType(index, MOVETYPE_VPHYSICS);
...
	}
	return Plugin_Handled;
}
still is not working for my model

Last edited by SWRHARD; 09-12-2019 at 03:09.
SWRHARD is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:35.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode