5a59d8e14f
14 newly-imported Synty Polygon packs (~2.46 GB; FBX/PNG/textures stored in Git LFS per .gitattributes). Enemy-grade characters: Werewolf, Kaiju, FantasyHeroCharacters, Vikings, Western, HorrorCarnival, Dog. Environment: Nature, NatureBiomes, PNB_Core, FantasyKingdom. UI/icons: Icons, InterfaceCore, InterfaceSciFiSoldierHUD. Werewolf + Kaiju back the DR-023 animated enemies; the rest are cataloged for future work in Docs/Vault/06_Roadmap/Synty_Asset_Inventory.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
56 lines
2.1 KiB
C#
56 lines
2.1 KiB
C#
/*
|
|
* POLYGON DOG CAMERA CONTROLLER SCRIPT
|
|
* DESCRIPTION: This script demonstrates the range of animations and Prefabs included in
|
|
* Polygon Dog which can be customized for the users preference. Please attach this to the
|
|
* Dog.Prefab asset then customize the keys for the particular animations.
|
|
*
|
|
* PLEASE NOTE: This script is intended for demonstration purposes and user customization or
|
|
* third party animation plugins will be required for further animation options
|
|
*/
|
|
using UnityEngine;
|
|
public class POLYGON_CameraController : MonoBehaviour
|
|
{
|
|
public Transform target;
|
|
public float followSpeed = 20f;
|
|
public float rotationSpeed = 20f;
|
|
public float cameraRotationX = 15.0f;
|
|
public float cameraPositionY = 1.8f;
|
|
public float cameraPositionZ = 2.0f;
|
|
float distance;
|
|
Vector3 position;
|
|
Vector3 newPosition;
|
|
Quaternion rotation;
|
|
Quaternion newRotation;
|
|
Transform camera;
|
|
// (Move to input script)
|
|
float MouseX;
|
|
void Start()
|
|
{
|
|
//camera start
|
|
distance = transform.position.y - target.position.y;
|
|
position = new Vector3(target.position.x, target.position.y + distance, target.position.z);
|
|
rotation = Quaternion.Euler(new Vector3(45f, target.rotation.eulerAngles.y, 0f));
|
|
// camera offset
|
|
camera = this.gameObject.transform.GetChild(0);
|
|
camera.position = new Vector3(0f, cameraPositionY, cameraPositionZ);
|
|
camera.rotation = Quaternion.Euler(cameraRotationX, 0f, 0f);
|
|
}
|
|
void Update()
|
|
{
|
|
MouseX += Input.GetAxis("Mouse X");
|
|
}
|
|
void LateUpdate()
|
|
{
|
|
if (target)
|
|
{
|
|
//camera follow
|
|
newPosition = target.position;
|
|
newPosition.y += (distance);
|
|
newRotation = Quaternion.Euler(new Vector3(0f, target.rotation.eulerAngles.y + MouseX, 0f));
|
|
position = Vector3.Lerp(position, newPosition, followSpeed * Time.deltaTime);
|
|
rotation = Quaternion.Lerp(rotation, newRotation, rotationSpeed * Time.deltaTime);
|
|
transform.position = position;
|
|
transform.rotation = rotation;
|
|
}
|
|
}
|
|
} |