YouGroove Posted March 2, 2013 Share Posted March 2, 2013 I want to use GotPoint() in a modified GoblinAI lua file. function Script:UpdatePhysics() local time=Time:GetCurrent() self.entity:GoToPoint(20,-25,0,1.4,1); --Check for a new target in the area if not self.target then ... It don't works, the character where i have binded AnimationManager and my new Lua File with the code above don't move (i put character controller for physics also in the editor) Does anyone have some idea ? self.entity refers to the 3D model on the scene (binded to that script) , or i'm wrong ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
YouGroove Posted March 2, 2013 Author Share Posted March 2, 2013 Here is my code for simple AI i attached to a character model : function Script:Start() if self.entity:GetMass()==0 then self.entity:SetMass(1.0) end --self.mass = self.entity:GetMass()-- save initial mass value --self.entity:SetMass(0) end function Script:UpdatePhysics() local time=Time:GetCurrent() self.entity:GoToPoint(20,-25,0,1.4,1); self.entity.animationmanager:SetAnimationSequence(self.sequence.walk,0.04,200) end function Script:Cleanup() ReleaseTableObjects(Script.sound) end *************** Why this not works ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Chris Vossen Posted March 2, 2013 Share Posted March 2, 2013 self.entity:GoToPoint(20,-25,0,1.4,1); So Entity::GoToPoint will move the entity if a path is available. The coordinate system is setup such that Y is "up" so -25 would be below the ground and no path will be found. Try changing it to 0. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted March 3, 2013 Author Share Posted March 3, 2013 My fault, doing copy/paste and not pay attention to the function parameters. Thanks a lot it worked I put some imported FBX model, i select rigid body collision with fit shape , but the character only avoid BSP and seems to go throught models. Perhaps a bug, or does the function only works in BSP geometry ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Chris Vossen Posted March 3, 2013 Share Posted March 3, 2013 Try setting the nav obstacle parameter to true, it's the bottom most check mark on the physics tab One helpful setting that you can use if you are working with the navigation system, is to turn on the show navigation in the editor. View->Show Navigation hopefully this helps Quote Link to comment Share on other sites More sharing options...
YouGroove Posted March 3, 2013 Author Share Posted March 3, 2013 Thanks Chris I had nav obstacle to true already and it was a box rigid body , but it didn' appear on the physic view. I clicked on FIT SHAPE and it worked, the cube collision appeared on the physic view. That's strange , could not the "FIT SHAPE" automatically process when you put some object you want collision on it ? What is the interest to have to click on FIT SHAPE ? Quote Stop toying and make games 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.