MrIslomaniac Posted July 17, 2010 Share Posted July 17, 2010 How do I set the MetersPerTile in code? I know that it works in the editor but when I try it in C++, it does not work because the terrain just wants the resolution. Yes I know I could also load a sbx-file, but then I can't access the Terrain: TEntity Scene = LoadScene("abstract::TestMap.sbx"); Terrain = FindChild(Scene,"Terrain"); That does not work =( Hope you can give me some advice MI Quote Link to comment Share on other sites More sharing options...
MrIslomaniac Posted July 17, 2010 Author Share Posted July 17, 2010 Ok, I just found out that if I load a Scene created in the Editor, the physic doesn't work either ... Just look at the picture I am really pissed, because this is a main feature of the engine, and also for my game, and it does not work. Correct me if I am wrong... This is the Cube I am using: http://rapidshare.com/files/407435681/Cube.rar This is the Scene: http://rapidshare.com/files/407435898/Scene.rar TEntity Scene = LoadScene("abstract::TestMap.sbx"); Almost always does the physic work as it should, but sometimes, I mean in special places on the terrain, it does not. Quote Link to comment Share on other sites More sharing options...
MrIslomaniac Posted July 17, 2010 Author Share Posted July 17, 2010 Anyone? Josh? What do you think of that problem? Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 17, 2010 Share Posted July 17, 2010 How do I set the MetersPerTile in code? I know that it works in the editor but when I try it in C++, it does not work because the terrain just wants the resolution. Yes I know I could also load a sbx-file, but then I can't access the Terrain: TEntity Scene = LoadScene("abstract::TestMap.sbx"); Terrain = FindChild(Scene,"Terrain"); That does not work =( Hope you can give me some advice MI You could use ScaleEntity on the terrain to set how many meters per tile since CreateTerrain always creates a terrain with 1 meter per tile. Ok, I just found out that if I load a Scene created in the Editor, the physic doesn't work either ... Just look at the picture I am really pissed, because this is a main feature of the engine, and also for my game, and it does not work. Correct me if I am wrong... This is the Cube I am using: http://rapidshare.com/files/407435681/Cube.rar This is the Scene: http://rapidshare.com/files/407435898/Scene.rar TEntity Scene = LoadScene("abstract::TestMap.sbx"); Almost always does the physic work as it should, but sometimes, I mean in special places on the terrain, it does not. Well, I cannot seem to get it to happen myself. But maybe I am not trying the same way you are doing it. What version of LE are you using? The latest release of LE appears to be using the latest newton SDK release which involved fixing collision glitches with terrain. Set the cube to have sweptcollision and you shouldn't be able to get it to fail. With the latest newton.dll, I couldn't get a very small complex shaped object moving at very high speed to pass through the terrain if I had SweptCollision on, no matter what angle the collision occurred. 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...
MrIslomaniac Posted July 17, 2010 Author Share Posted July 17, 2010 I am using the latest version (newton.dll 6 July 2010) and even cubes pass through the terrain -.- For collisions I am using Collisions(1,1,1); and then I set the type of the terrain and the cube on 1. So I am using slidingcollision. If it works that much better with SweptCollision, how do I make use of it without gamelib? Thanks for your reply Oh and btw, when I use scaleentity, the bugs are even worse, my controller can even look through the terrain... see this -> http://leadwerks.com/werkspace/index.php?/topic/2353-some-terrain-bugs-again/ Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 17, 2010 Share Posted July 17, 2010 I am using the latest version (newton.dll 6 July 2010) and even cubes pass through the terrain -.- For collisions I am using Collisions(1,1,1); and then I set the type of the terrain and the cube on 1. So I am using slidingcollision. If it works that much better with SweptCollision, how do I make use of it without gamelib? Thanks for your reply Oh and btw, when I use scaleentity, the bugs are even worse, my controller can even look through the terrain... see this -> http://leadwerks.com/werkspace/index.php?/topic/2353-some-terrain-bugs-again/ You would still use the same collision settings. SweptCollision is only applied to the cube itself. You can set it inside the editor with a lua script for the cube or you can just set it with code on the cube model. Well, the problem with ScaleEntity could be with the fact that you aren't scaling it uniformly. Try making the X,Y,Z scale all the same. When I scale the terrain, the terrain.meterspertile is always equal to the X value. 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...
MrIslomaniac Posted July 17, 2010 Author Share Posted July 17, 2010 you can just set it with code on the cube model. How would I do that? Scaling the terrain uniformly does not work, I get the same result. Here is an example of the editor having that problem, even with sweptcollision... You can test it yourself, just put the cube on the given coordinates Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 17, 2010 Share Posted July 17, 2010 you can just set it with code on the cube model. How would I do that? Scaling the terrain uniformly does not work, I get the same result. SweptCollision(cube,1) cannot say for terrain problem... the wiki says to use ScaleEntity, and i can see it changing the meterspertile value when scaled... dunno. Perhaps someday josh will enlighten everyone on how he is creating the terrain, resolution, altitude, etc... 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...
MrIslomaniac Posted July 17, 2010 Author Share Posted July 17, 2010 I would say that the physics model has some bugs in it, it seems as if it is turned by 90°, I am already using sweptcollision now ... here is a video, it is all explained what is wrong =) Josh, please do us the honor of explaining that Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 17, 2010 Share Posted July 17, 2010 what version are you using? I thought this issue was fixed here recently with the terrain/physics X&Z being swapped. edit--this program Josh provided shows the physics mesh working correctly now. Have you updated your SDK recently... Also, if this is a new bug, then you really need to provide a sample code that clearly demonstrates the issue you are having. One or two lines does not help anyone and really tests their willingness to create a program from scratch just to help you figure out what your problem could be... 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...
MrIslomaniac Posted July 17, 2010 Author Share Posted July 17, 2010 I am using the most recent release of the engine. Setting up an example as we speak. 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.