Has the locomotion system been tested with the built in terrain engine yet? It does not produced accurate results within my scene: It looks a bit like the locomotion system does some other interpolation/interpretation of the terrain’s hightmap data.
The Locomotion System works fine with the terrain here. Are you sure you have the terrain in a layer that the Locomotion System is seeing as the ground?
yes, the terrain is assigned to “Default” Layer – which you can see is set as “ground layer” – and actually the locomotion sytem sees the terrain.
I have put up a webplayer to give you a better impression.
I can see the problem in your web-player but I can’t reproduce it in a project myself.
Let’s see if it’s a problem with raycasts and terrains in general. Can you try this:
Create a small red cube.
Attach this script to it:
using UnityEngine;
using System.Collections;
public class GroundTracer : MonoBehaviour {
public GameObject target;
public LayerMask mask;
void Update () {
transform.position = target.transform.position;
RaycastHit hit;
Physics.Raycast(transform.position+1000*Vector3.up, -Vector3.up, out hit, 10000, mask);
transform.position = hit.point;
}
}
Now place your character in the target slot.
Use the same layermask as is used in the Locomotion System.
Set the cube object itself to be in some other layer, for example IgnoreRaycasts.
The cube will now follow the character around and always be at ground level using a raycast.
Now, if the cube hovers the same way as the character, we know that it’s not the Locomotion System but a problem with raycasts and terrains in general. If not - we’ll take it from there.
hi rune,
many thanks for your answer.
i don’t know whether i have good news for you or not – but to me it seems to be a problem of raycasting and the terrain … as even the small – sorry – white cube floats around or sinks into the terrain.
the only hint i can give: i raised the terrain once by 10m, than lowered it again by 10m… might this be the root of the problem?
it must be a bug in the terrain engine: setting up a new terrain and copying the height map data to this new terrain gives pretty good results with both: the animated character and the cube…
so i am pretty sure that raising and lowering again the terrain wasn’t a good idea at all…
It’s not supposed to cause these problems though and we would like to make sure that we get this fixed in future versions of Unity.
If you didn’t already, please file a bug report with the issue, and post the case number of the bug here. If you still have the broken version of the terrain, please attach that project. If not, then please make a copy of the project and see if you can break that one and make the issue appear again. We appreciate your help in getting this solved.
Hi Rune,
I have found a pretty easy way to fix the problem: I just deleleted the corrupted terrain from the hierarchy window and brought it back in from the Project window. That was all.
[As tree colliders also get corrupted on changing the terrain’s position I would have better never tried to do so…[Unity 2.1]]