Raised This Month: $ Target: $400
 0% 

Solved prop_dynamic collison not rotating?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Johnny2525
Junior Member
Join Date: May 2015
Old 05-27-2021 , 14:26   prop_dynamic collison not rotating?
Reply With Quote #1

Hi

So basically when I am teleporting newly created prop_dynamic object I am also rotating it, the model seems to be rotated but the model collision stays at angle 0 so it creates that "invisible wall" effect while the model is actually rotated.

Code:
wallModel = "models/props/hr_massive/wood_fence/wood_fence_128.mdl"

Ent = CreateEntityByName("prop_dynamic_override"); 
if(Ent != -1) {
	pos[0] = pos[0] + (fForward[0] * 107.0);
	pos[1] = pos[1] + (fForward[1] * 107.0);
	pos[2] = pos[2] + (fForward[2] * 107.0);

	DispatchKeyValue(Ent, "model", wallModel);
	DispatchKeyValue(Ent, "solid", "2");
	DispatchSpawn(Ent);

	float objAngles[3];
	objAngles[0] = 0.0;
	objAngles[1] = 0.0;
	objAngles[2] = 0.0;

	objAngles[1] = 90.0;
		
	
	//SetEntPropVector(Ent, Prop_Send, "m_angRotation", objAngles);
	TeleportEntity(Ent, pos, objAngles, NULL_VECTOR);
	
	SetEntityRenderMode(Ent, RENDER_TRANSCOLOR);
	SetEntityRenderColor(Ent, 255, 255, 255, 255);
	
	SetEntProp(Ent, Prop_Data, "m_takedamage", DAMAGE_YES, 1);
	SetEntProp(Ent, Prop_Data, "m_iHealth", 65); 
}


Does it have something to do with the model by itself?
If somebody could help me with this case

Last edited by Johnny2525; 06-03-2021 at 09:18. Reason: Solved
Johnny2525 is offline
andi67
Veteran Member
Join Date: Mar 2007
Location: Somewhere near you!!!
Old 05-28-2021 , 06:46   Re: prop_dynamic collison not rotating?
Reply With Quote #2

Code:
	float objAngles[3];
	objAngles[0] = 0.0;
	objAngles[1] = 0.0;
	objAngles[2] = 0.0;

	objAngles[1] = 90.0;
maybe you should simply try:

Code:
	float objAngles[3];
	objAngles[0] = 0.0;
	objAngles[1] = 90.0;
	objAngles[2] = 0.0;
__________________
Waiting for HL3,Day of Defeat3 ,but will it ever come? So I'm gonna play COD WW2.>>>>SM_SKINCHOOSER<<<<
>>You need Models for DODS/CSS/CSGO , than click here!!!<<
andi67 is offline
Johnny2525
Junior Member
Join Date: May 2015
Old 05-28-2021 , 07:01   Re: prop_dynamic collison not rotating?
Reply With Quote #3

I've searched a little more and found couple of lines which I added to my code, and it works.

Code:
DispatchKeyValue(Ent, "Solid", "6");
SetEntProp(Ent, Prop_Data, "m_nSolidType", 6);
DispatchKeyValue(Ent, "spawnflags", "8"); 
SetEntProp(Ent, Prop_Data, "m_CollisionGroup", 5);
DispatchSpawn(Ent);
AcceptEntityInput(Ent, "EnableCollision");
I didn't really have time to understand why it works now but I hope its gonna help somebody


Code:
wallModel = "models/props/hr_massive/wood_fence/wood_fence_128.mdl"

Ent = CreateEntityByName("prop_dynamic_override"); 
if(Ent != -1) {
	pos[0] = pos[0] + (fForward[0] * 107.0);
	pos[1] = pos[1] + (fForward[1] * 107.0);
	pos[2] = pos[2] + (fForward[2] * 107.0);

        DispatchKeyValue(Ent, "model", wallModel);
	DispatchKeyValue(Ent, "Solid", "6");
	SetEntProp(Ent, Prop_Data, "m_nSolidType", 6);
	DispatchKeyValue(Ent, "spawnflags", "8"); 
	SetEntProp(Ent, Prop_Data, "m_CollisionGroup", 5);
	DispatchSpawn(Ent);
	AcceptEntityInput(Ent, "EnableCollision");

	float objAngles[3];
	objAngles[0] = 0.0;
	objAngles[1] = 0.0;
	objAngles[2] = 0.0;

	objAngles[1] = 90.0;
		
	
	//SetEntPropVector(Ent, Prop_Send, "m_angRotation", objAngles);
	TeleportEntity(Ent, pos, objAngles, NULL_VECTOR);
	
	SetEntityRenderMode(Ent, RENDER_TRANSCOLOR);
	SetEntityRenderColor(Ent, 255, 255, 255, 255);
	
	SetEntProp(Ent, Prop_Data, "m_takedamage", DAMAGE_YES, 1);
	SetEntProp(Ent, Prop_Data, "m_iHealth", 65); 
}

Last edited by Johnny2525; 05-28-2021 at 08:36.
Johnny2525 is offline
Reply



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 20:00.


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