That doesn’t help much
Why is there? What can it do that normal Terrain can’t? How do I use it?
From the API I deduce that it’s there to create larger terrains using small portions linked together. But then it doesn’t make sense that you can simply skip them and render Terrain directly. Terrain is not even Drawable and thus can’t be hit by raycast (don’t know why it can be rendered however).
[code] – Create heightmap terrain
terrainNode = scene_:CreateChild(“Terrain”)
terrainNode.position = Vector3(0.0, 0.0, 0.0)
local terrain = terrainNode:CreateComponent(“Terrain”)
terrain.patchSize = 64
terrain.spacing = Vector3(2.0, 0.5, 2.0) – Spacing between vertices and vertical resolution of the height map
terrain.smoothing = true
terrain.heightMap = cache:GetResource(“Image”, “Textures/HeightMap.png”)
terrain.material = cache:GetResource(“Material”, “Materials/Terrain.xml”)
– The terrain consists of large triangles, which fits well for occlusion rendering, as a hill can occlude all
– terrain patches and other objects behind it
terrain.occluder = true
local body = terrainNode:CreateComponent("RigidBody")
body.collisionLayer = 2 -- Use layer bitmask 2 for static geometry
local shape = terrainNode:CreateComponent("CollisionShape")
shape:SetTerrain()
local terrainPatchNode = scene_:CreateChild("TerrainPatch")
terrainPatchNode.position = Vector3(0.0, 0.0, 0.0)
local terrainPatch = terrainNode:CreateComponent("TerrainPatch")
terrainPatch.coordinates = IntVector2(0,0)
terrainPatch.owner = terrain
terrainPatch.material = cache:GetResource("Material", "Materials/StoneTiled.xml")
terrainPatch.boundingBox = BoundingBox(-10000.0, 10000.0)[/code]
That code gives the following ERROR: Null index buffer and no raw index data, can not define indexed draw range
What’s wrong with it?