16
NGUI 3 Support / Re: Show UILabel/Sprite above Player?
« on: April 21, 2014, 09:30:13 AM »
Mhm, I figured something out. I have a script which is responsible for a smooth (Main)Camera-Follow.
I noticed, when I remove that script, it works how it should!
This is what's happening in the script:
What sould I change in order to get it to work with the Camera-Follow?
I noticed, when I remove that script, it works how it should!
This is what's happening in the script:
- void Update ()
- {
- Vector3 _tmp = thisTransform.position;
- if(target.position.y < level_minY)
- {
- _tmp.y = Mathf.SmoothDamp(thisTransform.position.y, level_minY,
- ref velocity.y, smoothTime);
- thisTransform.position = _tmp;
- }
- else if(target.position.y > level_minY && target.position.y < level_maxY)
- {
- _tmp.y = Mathf.SmoothDamp(thisTransform.position.y, target.position.y,
- ref velocity.y, smoothTime);
- thisTransform.position = _tmp;
- }
- else if(target.position.y > level_maxY)
- {
- _tmp.y = Mathf.SmoothDamp(thisTransform.position.y, target.position.y,
- ref velocity.y, smoothTime);
- thisTransform.position = _tmp;
- }
- if(target.position.x <= level_minX)
- {
- _tmp.x = Mathf.SmoothDamp( thisTransform.position.x,
- level_minX, ref velocity.x, smoothTime);
- thisTransform.position = _tmp;
- }
- // ABSOLUTER PUNKT RECHTS
- else if(target.position.x >= level_maxX)
- {
- _tmp.x = Mathf.SmoothDamp( thisTransform.position.x,
- level_maxX, ref velocity.x, smoothTime);
- thisTransform.position = _tmp;
- }
- // ANSONSTEN FOLGEN
- else
- {
- _tmp.x = Mathf.SmoothDamp( thisTransform.position.x,
- target.position.x, ref velocity.x, smoothTime);
- thisTransform.position = _tmp;
- }
- }
What sould I change in order to get it to work with the Camera-Follow?





