Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using UnityEngine;
- namespace StylizedWater2.Examples
- {
- [ExecuteAlways]
- public class SetWaterPositionOffset : MonoBehaviour
- {
- public bool negate;
- private void Update()
- {
- //Note: in a floating origin system, apply the value after offsetting all the transforms!
- //Otherwise the water geometry gets shifted in one frame, and this offset is applied the next. This induces a jitter.
- StylizedWater2.WaterObject.PositionOffset = negate ? -this.transform.position : this.transform.position;
- }
- private void OnDisable()
- {
- StylizedWater2.WaterObject.PositionOffset = Vector3.zero;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement