cassius Posted June 24, 2013 Share Posted June 24, 2013 I have a character called badguy with a controller called bg_control. I want this character to walk toward the player at all times using SetInput. I am struggling on how to express the angle parameter. Can anyone help. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Rick Posted June 25, 2013 Share Posted June 25, 2013 Generally speaking you don't use SetInput() for NPC/AI. Look at functions like Follow() or GoToPoint(). http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/ look at the Navigation section for others. It really is that easy Quote Link to comment Share on other sites More sharing options...
cassius Posted June 25, 2013 Author Share Posted June 25, 2013 ok thanks. I was thinking SetInput was the same as UpdateController in le2 Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Rick Posted June 25, 2013 Share Posted June 25, 2013 It is, but LE3 gives you these 2 new functions that make our lives easier for AI. Quote Link to comment Share on other sites More sharing options...
cassius Posted June 25, 2013 Author Share Posted June 25, 2013 I used follow which works ok exept the enemy character half sinks into the ground when moving and behaves erratically when close to player going around in a circle. Its controller is a pivot to which it is parented. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Rick Posted June 25, 2013 Share Posted June 25, 2013 Follow() seems like it tries to get to the exact point the thing it's following is. This however generally isn't possible because it collides with the thing it's following. Generally you'll want to do a distance check with the thing it's following and when it's < a certain value call Stop() to make it stop following. I noticed the sinking into the ground (only in certain areas of the map) also. Might be a bug? Quote Link to comment Share on other sites More sharing options...
cassius Posted June 25, 2013 Author Share Posted June 25, 2013 Yeah. I tried gotopoint and got the same problem. bg_control->GoToPoint(player->GetPosition(), 2.0, 1); Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Rick Posted June 25, 2013 Share Posted June 25, 2013 Yeah, you have to check the distance and call Stop() if within a certain distance. Quote Link to comment Share on other sites More sharing options...
josk Posted June 25, 2013 Share Posted June 25, 2013 The tutorial by Aggror is good, I use Lua but made sense of it. Here. Quote Elite Cobra Squad Link to comment Share on other sites More sharing options...
YouGroove Posted June 25, 2013 Share Posted June 25, 2013 I noticed the sinking into the ground (only in certain areas of the map) also. Might be a bug? Has it is been submitted with files example on bug section ? Some even mobile game with such problem would not do it. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
cassius Posted June 25, 2013 Author Share Posted June 25, 2013 Might be a pjysics bug. Sometimes in le2 there were similar problems. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
cassius Posted June 25, 2013 Author Share Posted June 25, 2013 Fized it. My main character was too high off the ground ( my eyesight is quite bad) and pointentity made the enemy character look up at main character as it approached main character. Thanks for help Its a darkish scene I think more light would have helped. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Rick Posted June 25, 2013 Share Posted June 25, 2013 Yeah, a design light is something I'd like to see implemented in the editor. Something that we can toggle on/off and only for the editor and not in game so we can easily design with full brightness, because it's clearly easier, and then toggle it off to see how it looks "in game". 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.