| 
		
 | 
	| 
		
 | 
	
		
		
			| Re: Commands->Set_Facing [message #428733 is a reply to message #428721] | 
			Wed, 19 May 2010 00:57    | 
		 
		
			
				
				
				  | 
					
						  
						danpaul88
						 Messages: 5795 Registered: June 2004  Location: England
						
	Karma: 0
 
					 | 
					General (5 Stars)  | 
					 | 
		 
		 
	 | 
 
	
		Try setting the looking at location instead for infantry, I can't remember the names of the functions off the top of my head but it lets you set where the infantry unit is 'looking', hence setting the direction it's facing in. 
 
Quick bit of maths to determine the x,y,z of a location 1m from the unit in the direction you want it to face should be all you need. 
 
 
 
EDIT: I think it's called something like Force_Camera_Look_Player, but IIRC it should work for AI too.... give it a try.
		
		
 
  
		[Updated on: Wed, 19 May 2010 01:02] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 | 
	
		
		
			| Re: Commands->Set_Facing [message #428740 is a reply to message #428721] | 
			Wed, 19 May 2010 02:17    | 
		 
		
			| 
				
	 | 
 
	
		Force_Camera_Look_Player is not what you want. You pass it the GameObject for a player and it forces that players camera to face and look at a given position. 
Set_Facing should work just fine for infantry, I know its been used for infantry before. 
		
		
  Jonathan Wilson aka Jonwil 
Creator and Lead Coder of the Custom scripts.dll 
Renegade Engine Guru 
Creator and Lead Coder of TT.DLL 
Official member of Tiberian Technologies 
		
 |  
	| 
		
	 | 
 
 
 | 
	| 
		
 | 
	| 
		
 | 
	| 
		
 | 
	
		
		
			| Re: Commands->Set_Facing [message #428771 is a reply to message #428721] | 
			Wed, 19 May 2010 10:12    | 
		 
		
			
				
				
				  | 
					
						  
						danpaul88
						 Messages: 5795 Registered: June 2004  Location: England
						
	Karma: 0
 
					 | 
					General (5 Stars)  | 
					 | 
		 
		 
	 | 
 
	
		Just a thought... have you tried introducing a delay between Set_Position and Set_Facing? It's plausible that for infantry units you can't do them both in the same engine tick for whatever reason.... either try setting the facing only, or use a delayed custom to trigger the Set_Facing call on the next engine tick (ie: 0.001 second delay) 
 
I know I have found cases like this with other things in the engine, where trying to do two things at once to an object either caused one of the two to fail or the game to simply crash.
		
		
 
  
		[Updated on: Wed, 19 May 2010 10:13] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 | 
	| 
		
 | 
	
		
		
			| Re: Commands->Set_Facing [message #428774 is a reply to message #428771] | 
			Wed, 19 May 2010 10:34    | 
		 
		
			
				
				
				  | 
					
						  
						Ethenal
						 Messages: 2532 Registered: January 2007  Location: US of A
						
	Karma: 0
 
					 | 
					General (2 Stars)  | 
					 
  | 
		 
		 
	 | 
 
	
		| danpaul88 wrote on Wed, 19 May 2010 12:12 |   Just a thought... have you tried introducing a delay between Set_Position and Set_Facing? It's plausible that for infantry units you can't do them both in the same engine tick for whatever reason.... either try setting the facing only, or use a delayed custom to trigger the Set_Facing call on the next engine tick (ie: 0.001 second delay) 
 
I know I have found cases like this with other things in the engine, where trying to do two things at once to an object either caused one of the two to fail or the game to simply crash.
  |  
  
I tried exactly that, I originally had the Set_Position and Set_Facing functions called by a single SSGM chat hook, but I split it up into two and tried the Set_Facing part separately... didn't work. 
 
That's exactly how I called it Hex (minus the variable name), but it just doesn't work. It's not like I'm passing it an invalid argument or anything else it would have crashed by now... it simply doesn't do anything.
		
		
 
 | -TLS-DJ-EYE-K wrote on Mon, 18 March 2013 07:29 |   Instead of showing us that u aren't more inteligent than a Toast, maybe you should start becomming good in renegade    
  |  
  
		[Updated on: Wed, 19 May 2010 10:35] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 | 
	| 
		
 | 
	| 
		
 | 
	
		
		
			| Re: Commands->Set_Facing [message #428914 is a reply to message #428721] | 
			Fri, 21 May 2010 02:19    | 
		 
		
			
				
				
				  | 
					
						  
						Hex
						 Messages: 858 Registered: March 2004 
						
	Karma: 0
 
					 | 
					Colonel  | 
					 | 
		 
		 
	 | 
 
	
		Commands->Set_Position(o,Vector3(101,-34,-7)); Force_Camera_Look_Player(o, 129);  
 
Can someone try this because it gives me really odd results
		
		
 
 | goztow wrote on Tue, 11 May 2010 08:00 |   If we had to ban all who ever cheated or ever created a cheat (obj3cts and such) then I don't think there would be many members left here (sad fact).
  |  
  
 
| reborn wrote on Fri, 29 January 2010 23:37 |   std is for pro's.  
  |   
		[Updated on: Fri, 21 May 2010 02:45] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 | 
	
		
		
			| Re: Commands->Set_Facing [message #428915 is a reply to message #428914] | 
			Fri, 21 May 2010 02:43    | 
		 
		
			
				
				
				  | 
					
						  
						danpaul88
						 Messages: 5795 Registered: June 2004  Location: England
						
	Karma: 0
 
					 | 
					General (5 Stars)  | 
					 | 
		 
		 
	 | 
 
	
		| Hex wrote on Fri, 21 May 2010 10:19 |  
 Commands->Set_Position(o,Vector3(101,-34,-7)); Force_Camera_Look_Player(o, 129);  
 
Can someone try this because it gives me really odd results
  |  
  
 
 
Ignore that bit about Force_Camera_Look_Player, it's not exactly what I was thinking it was... bit of a brain fart moment. 
 
 
 
EDIT: Just a thought... is Set_Facing expecting a value in degrees or radians? If it's expecting radians that's probably why it's not working properly. I would assume it's degrees but you never know...
		
		
 
  
		[Updated on: Fri, 21 May 2010 02:45] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 | 
	| 
		
 | 
	| 
		
 | 
	| 
		
 | 
	
		
		
			| Re: Commands->Set_Facing [message #429056 is a reply to message #428721] | 
			Sat, 22 May 2010 14:59    | 
		 
		
			
				
				
				  | 
					
						  
						danpaul88
						 Messages: 5795 Registered: June 2004  Location: England
						
	Karma: 0
 
					 | 
					General (5 Stars)  | 
					 | 
		 
		 
	 | 
 
	
		Just a thought: you weren't trying to use this on AI bots were you? If you were the bots would have simply turned around again to face the direction the AI wants to face in and ignore the facing you were setting... You would have to use the ActionParamsStruct and related functions to instruct the AI to face a particular direction.
		
		
 
  
		[Updated on: Sat, 22 May 2010 15:00] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 | 
	| 
		
 | 
	
		
		
			| Re: Commands->Set_Facing [message #429295 is a reply to message #429115] | 
			Tue, 25 May 2010 06:19   | 
		 
		
			
				
				
				  | 
					
						  
						Jerad2142
						 Messages: 3826 Registered: July 2006  Location: USA
						
	Karma: 6
 
					 | 
					General (3 Stars)  | 
					 | 
		 
		 
	 | 
 
	
		Set_Facing works on all human and vehicle objects except for infantry that are controlled by the player, which it still works for, the players camera just instantly override the Set_Facing command, rotating the player's character back to what their camera is  facing.  
 
float PI = 3.14159265f,Facing = 90.0f;
Vector3 pos = Commands->Get_Bone_Position(obj,"c head");
pos.X += 20.0f*(cos(Facing*PI/180));
pos.Y += 20.0f*(sin(Facing*PI/180));
Force_Camera_Look_Player(obj,pos);  
		
		
 
  
Visit Jerad's deer sweat shop
		
 |  
	| 
		
	 | 
 
 
 |