- Home /
Presentation Idea
I was wondering if there was a way to assign key commands to a camera path. Like if I press this button, the camera moves from one point to the other. I thought that this would perfect to use along with Live2D assets that I'm going to make. I'd have the assets somewhere and the camera would just go to them. Somewhat like a 3D powerpoint.
Thank you.
Answer by Osmious · Jun 06, 2017 at 07:57 AM
Sorry @Introverted-Shinso but your question does not clarify what you want.
From what I figured, it seems like you need a system that plays animations on a specific keypress, to do this... you need to :
1) Attach the script given in bottom to the GameObject you want to animate
2) Create an animation and mark it as legacy
3) Add the animation to the animation component automatically added
4) Fill in the values asked in Editor for the script (Unless you'll get null reference exceptions)
5) press ctrl/cmd + p
6) enjoy!
The script:
//AxisAnimation v1.1
//
//Licensed under creative commons 0 (CC0) Share-Alike
//TESTED WITH UNITY 5.6, ERRORS MAY APPEAR ON OTHER VERSIONS
using System;
using UnityEngine;
[RequireComponent(typeof (Animation))]
public class AxisAnimation : MonoBehaviour {
//public variables
public String[] AnimationName;
public String ButtonToUse;
//private variables
private Animation AnimationObject;
//called once when object/script is enabled before first update call
void Start(){
AnimationObject = gameObject.GetComponent<Animation>();
}
//called every Frame
void Update(){
if(Input.GetButtonDown(ButtonToUse)){
foreach(String i in AnimationName){
AnimationObject.Play(i);
}
}
}
}
Answer by Introverted-Shinso · Jun 16, 2017 at 06:30 AM
yes! Thank you! I'm very sorry about the misunderstanding. I just started using unity and am finding things sort've hazy and this is probably something outside my skill level. Thank you for your answer!
Happy to help @Introverted-Shinso
Hope your project goes well... Just one more thing, Click the checkmark besides my answer so anyone browsing through the site knows that This question has been answered and they can be helped too
Your answer
![](https://koobas.hobune.stream/wayback/20220612123406im_/https://answers.unity.com/themes/thub/images/avi.jpg)