xtreampb Posted February 4, 2016 Share Posted February 4, 2016 So I just frustratingly figured out that if you wrap the entity navigation functions in an if check (in lua) then the actual movement doesn't happen if it results to true. It would be nice to denote this in the API documentation. I'll put a comment in there for future reference. Quote bool Life() { while(death=false) { if(death==true) return death; } } I have found the secret to infinite life Did I help you out? Like my post! Link to comment Share on other sites More sharing options...
Einlander Posted February 4, 2016 Share Posted February 4, 2016 Can we see the code that you used to make this happen? Quote Link to comment Share on other sites More sharing options...
macklebee Posted February 4, 2016 Share Posted February 4, 2016 So I just frustratingly figured out that if you wrap the entity navigation functions in an if check (in lua) then the actual movement doesn't happen if it results to true. It would be nice to denote this in the API documentation. I'll put a comment in there for future reference. Are you sure? because I just used the default example code and used the exact code you said didn't work and the player moved. window = Window:Create() context = Context:Create(window) world = World:Create() local camera = Camera:Create() camera:SetRotation(35,0,0) camera:Move(0,0,-8) local light = DirectionalLight:Create() light:SetRotation(35,35,0) camera:SetDebugNavigationMode(true) local ground = Model:Box(10,1,10) ground:SetPosition(0,-0.5,0) ground:SetColor(0.0,0.25,0.0) local shape = Shape:Box(0,0,0, 0,0,0, 10,1,10) ground:SetShape(shape) shape:Release() entity = Model:Box(1,1,3) entity:SetColor(0.0,0.0,1.0) entity:SetPosition(0,0.5,0) local shape = Shape:Box(0,0,0,0,0,0,1,1,3) entity:SetShape(shape) shape:Release() ground:SetNavigationMode(true) entity:SetNavigationMode(true) world:BuildNavMesh() player = Pivot:Create() local visiblecapsule = Model:Cylinder(16,player) visiblecapsule:SetScale(1,2,1) visiblecapsule:SetPosition(0,1,0) player:SetPosition(-4,0,0) player:SetMass(1) player:SetPhysicsMode(Entity.CharacterPhysics) while window:KeyHit(Key.Escape)==false do if window:Closed() then break end if player:GoToPoint(4,0,0,1.4,1) then end Time:Update() world:Update() world:Render() context:SetBlendMode(Blend.Alpha) context:DrawText("NavMode: ".. tostring(entity:GetNavigationMode()),2,2) context:Sync() end Also, the example code you posted for Entity:Follow() is the incorrect syntax - so maybe thats why it didn't work? Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Einlander Posted February 4, 2016 Share Posted February 4, 2016 The gotopoint function returns weather or not you can reach the point, so you have to actually call the command again to start moving Quote Link to comment Share on other sites More sharing options...
macklebee Posted February 5, 2016 Share Posted February 5, 2016 The gotopoint function returns weather or not you can reach the point, so you have to actually call the command again to start moving Not from what I am seeing. Just one call to it will make the entity move if the point can actually be reached. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Einlander Posted February 5, 2016 Share Posted February 5, 2016 if player:GoToPoint(x,y,z) then end This means can the player reach the point, yes or no. It doesn't tell the player to actually go there though. Quote Link to comment Share on other sites More sharing options...
macklebee Posted February 5, 2016 Share Posted February 5, 2016 if player:GoToPoint(x,y,z) then end This means can the player reach the point, yes or no. It doesn't tell the player to actually go there though. Did you actually try the example script i posted? You can even take that code out of the main loop and the player will still move to the point if it can be reached. Whether you think this is wrong is another discussion. You are saying it shouldn't move the entity but only state if the point can be reached and the OP is saying that it should move the entity but doesn't. The example code shows that it does make the player move to the point if reachable even if its in a if/then statement. Unless there is a difference in versions (I am using the beta) that everyone is using and some fundamental thing has changed, then any use of this command that returns true will make the entity move to that point. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Einlander Posted February 5, 2016 Share Posted February 5, 2016 I just re-checked, you are right macklebee. If it is reachable it will move to that point regardless of how it is called. Honestly I think it should not move if you have it in an if then statement, but that's another matter. Quote Link to comment Share on other sites More sharing options...
Rick Posted February 5, 2016 Share Posted February 5, 2016 Code doesn't really work that way right. The function doesn't know the context in which it's called. You're really asking for a new function like CanMoveToPoint(). 1 Quote Link to comment Share on other sites More sharing options...
AfterDeath Posted April 2, 2017 Share Posted April 2, 2017 Can anyone explain how too make U3D_Mesh move too AINavPoint please; i can't seem too find anything a new person can understand it's getting a lil frustrating they won't let me put AINavPoint into the Target. Thank you in advance. 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.