Arska134 Posted May 6, 2012 Share Posted May 6, 2012 Hello! I need to ask you guys how i can point my controller to facing another. I made zombies in my game with controllers. Is it even good idea? I came up with idea of using controllers, because it's easy to determine if zombie is falling or crouching. But now i have some problems when i am trying to make zombies follow player model. I'll stick with controllers, or something else? Thanks. Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Rick Posted May 6, 2012 Share Posted May 6, 2012 Use PointEntity() on the zombie model on the Y axis. Then use the zombies Y rotation value via (EntityRotation(zombie).Y) for the rotation value to use for the controller. This will point the model and make moving "forward" with the controller move towards the player. Quote Link to comment Share on other sites More sharing options...
Arska134 Posted May 6, 2012 Author Share Posted May 6, 2012 What if controller is parent of zombie model? Still works? Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
cassius Posted May 6, 2012 Share Posted May 6, 2012 pointEntity(zombie,playerl,3,1,0) UpdateController(zombie.control,zombie.rotation.y,2.5, 0, 500,1,0) 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 May 6, 2012 Share Posted May 6, 2012 Don't parent the controller to the model. It can run into issues. After UpdateController(), position the zombie model to the controller position instead. Quote Link to comment Share on other sites More sharing options...
Arska134 Posted May 6, 2012 Author Share Posted May 6, 2012 pointEntity(zombie,playerl,3,1,0) UpdateController(zombie.control,zombie.rotation.y,2.5, 0, 500,1,0) Hmm... when i use maxacceleration 500 zombie launches to another planet straight away. O_O Without that, zombie changes direction pretty slowly. :/ Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
cassius Posted May 6, 2012 Share Posted May 6, 2012 Try a lower value like 100. The speed of 2.5 can also be changed possibly to a lower number.I just played around with these values till I got a good result. Didn't really know what I was doing. But it works fine. 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...
Arska134 Posted May 7, 2012 Author Share Posted May 7, 2012 Try a lower value like 100. The speed of 2.5 can also be changed possibly to a lower number.I just played around with these values till I got a good result. Didn't really know what I was doing. But it works fine. Even with maxacceleration of 1, it still flys sky high. Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Rick Posted May 7, 2012 Share Posted May 7, 2012 Are you still parenting? Parenting can lead to some funky stuff sometimes. Worth a shot to unparent if you are still doing it. Other things like mass maybe? Been awhile since I used controllers so can't remember off the top of my head. Quote Link to comment Share on other sites More sharing options...
Arska134 Posted May 7, 2012 Author Share Posted May 7, 2012 Are you still parenting? Parenting can lead to some funky stuff sometimes. Worth a shot to unparent if you are still doing it. Other things like mass maybe? Been awhile since I used controllers so can't remember off the top of my head. I am not parenting them anymore. Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
cassius Posted May 7, 2012 Share Posted May 7, 2012 I have parented the player but not the enemy characters.Rick is right, the problem is not in the updatecontroller code. 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...
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.