Jump to content

CreateTerrain Parameters


MrIslomaniac
 Share

Recommended Posts

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

Link to comment
Share on other sites

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.

post-171-034676600 1279364791_thumb.jpg

Link to comment
Share on other sites

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.

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

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/

Link to comment
Share on other sites

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.

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

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

post-171-087734100 1279392877_thumb.jpg

Link to comment
Share on other sites

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...

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

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... :)

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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...