public override void OnAttachedToNode(Node node) { CursorNode = node.CreateChild("SpatialCursor"); CursorModelNode = CursorNode.CreateChild("SpatialCursorModel"); CursorModelNode.SetScale(0.05f); var staticModel = CursorModelNode.CreateComponent <StaticModel>(); staticModel.Model = CoreAssets.Models.Torus; Material mat = new Material(); mat.SetTechnique(0, CoreAssets.Techniques.NoTextureOverlay, 1, 1); mat.SetShaderParameter("MatDiffColor", Color.Cyan); CursorModelNode.RunActions(new RepeatForever(new ScaleTo(0.3f, 0.06f), new ScaleTo(0.3f, 0.04f))); staticModel.SetMaterial(mat); staticModel.ViewMask = 0x80000000; //hide from raycasts base.OnAttachedToNode(node); ReceiveSceneUpdates = true; // find Octree and Camera components: octree = Scene.GetComponent <Octree>(true); //camera = Scene.GetComponent<Camera>(true); -- doesn't work! :(( ugly workaround: camera = Scene.GetChildrenWithComponent <Camera>(true)[0].GetComponent <Camera>(); }
public override void OnAttachedToNode(Node node) { CursorNode = node.CreateChild("SpatialCursor"); CursorModelNode = CursorNode.CreateChild("SpatialCursorModel"); CursorModelNode.SetScale(0.05f); var staticModel = CursorModelNode.CreateComponent <StaticModel>(); staticModel.Model = CoreAssets.Models.Torus; Material mat = new Material(); mat.SetTechnique(0, CoreAssets.Techniques.NoTextureOverlay, 1, 1); mat.SetShaderParameter("MatDiffColor", Color.Cyan); RunIdleAnimation(); staticModel.SetMaterial(mat); staticModel.ViewMask = 0x80000000; //hide from raycasts base.OnAttachedToNode(node); ReceiveSceneUpdates = true; }
public async void ClickAnimation() { Color originalColor = Color.Cyan; Color clickColor = Color.Yellow; CursorModelNode.RemoveAllActions(); var staticModel = CursorModelNode.GetComponent <StaticModel>(); if (staticModel != null) { var specColorAnimation = new ValueAnimation(); specColorAnimation.SetKeyFrame(0.0f, originalColor); specColorAnimation.SetKeyFrame(0.2f, clickColor); specColorAnimation.SetKeyFrame(0.4f, originalColor); var mat = staticModel.GetMaterial(0); mat?.SetShaderParameterAnimation("MatDiffColor", specColorAnimation, WrapMode.Once, 1.0f); } await CursorModelNode.RunActionsAsync(new ScaleTo(0.2f, 0.07f), new ScaleTo(0.4f, 0.04f)); RunIdleAnimation(); }
public void RunIdleAnimation() { CursorModelNode.RemoveAllActions(); CursorModelNode.RunActions(new RepeatForever(new ScaleTo(0.3f, 0.05f), new ScaleTo(0.3f, 0.03f))); }