Files
Project-M/Assets/Synty/PolygonHorrorCarnival/Scripts/FerrisWheelController.cs
T
kronic 5a59d8e14f Add Synty asset packs (enemies + environment/FX/UI) via Git LFS
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>
2026-06-06 23:28:47 -07:00

44 lines
1.4 KiB
C#

using UnityEngine;
public class FerrisWheelController : MonoBehaviour
{
[Header("Ride Controls")]
public float rotationSpeed = 15.0f;
public float rockingSpeed = .2f;
public float rockingAmplitude = 18f;
public Transform[] chairs;
public Transform[] wheelsForward;
public Transform[] wheelsReverse;
private float timeCounter = 0.0f;
private void Update()
{
// Rotate the Ferris wheel
transform.Rotate(Vector3.back * rotationSpeed * Time.deltaTime);
//rotate top wheels forwards with rotation speed multiplier
foreach (Transform wheelFwd in wheelsForward)
{
wheelFwd.Rotate(Vector3.forward * rotationSpeed * Time.deltaTime * 10);
}
///rotate bottom wheels backwards with rotation speed multiplier
foreach (Transform wheelRev in wheelsReverse)
{
wheelRev.Rotate(Vector3.back * rotationSpeed * Time.deltaTime * 10);
}
//chair rocking motion
foreach (Transform chair in chairs)
{
timeCounter += rockingSpeed * Time.deltaTime;
// rotation speed added to reduce/add more motion depending on ferris wheel speed
float rockingOffset = Mathf.Sin(timeCounter) * rockingAmplitude * (rotationSpeed/10);
chair.localRotation = Quaternion.Euler(0, 0, rockingOffset);
}
}
}